Как объявить глобальную переменную в javascript

Что бы объявить глобальную переменную нужно всего лишь удалить var перед переменной, и тогда она станет доступна по всей области видимости.

$(‘a[name=modal]’).click(function(e) {
//Cancel the link behavior
e.preventDefault();
//Get the A tag
var id = $(this).attr(‘href’);
id2 = $(this).attr(‘id’);

$(‘a[name=confirmdelete]’).click(function(e) {

alert(id2);

});

Как объявить глобальную переменную в javascript

4 мыслей о “Как объявить глобальную переменную в javascript

  • 10.03.2024 в 04:24
    Permalink

    Wow, awesome blog format! How lengthy have you been running a
    blog for? you made running a blog look easy. The full look of your website
    is great, let alone the content material!
    You can see similar here ecommerce

  • 13.03.2024 в 01:22
    Permalink

    Wow that was unusual. I just wrote an really long comment
    but after I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Regardless, just wanted to say superb blog!

    I saw similar here: Sklep online

  • 14.03.2024 в 20:18
    Permalink

    Piece of writing writing is also a excitement, if you know then you can write if
    not it is difficult to write. I saw similar here: Dobry sklep

  • 28.03.2024 в 16:04
    Permalink

    Howdy! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good success. If you know of any please
    share. Appreciate it! You can read similar article here:
    Sklep online

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *