JQuery only works in firefox or safari / chrome console

I have this weird mistake. My jQuery code works in Firefox, and also when I paste it into Safari or the Chrome console.

I downloaded it first, and I'm sure it reads that it is causing a warning. Do you see something wrong with the code that might affect this problem?

$(document).ready(function(){
    var questionOne = $('.questions').find('.question').eq(0);
    questionOne.removeClass('hide');
});

I have no errors in the console. I tried to download the script, I think all this is possible on the Internet.

+4
source share
1 answer

, , , , , ".questions" , . , , .

$(document).ready(function () {
var Counter = 0;
var interval = setInterval(function () {
            Counter += 20;
            var questionOne = $('.questions').find('.question').eq(0);
            questionOne.removeClass('hide');
            if (questionOne.length > 0)
                Counter = 3000;
            if (Counter >= 3000)
                clearInterval(interval)
        }, 2);
    });

>

$(document).ready(function () {
      setTimeout(function () {
        var questionOne = $('.questions').find('.question').eq(0);
        questionOne.removeClass('hide');
    }, 100);
});

>

hop .

+1

Source: https://habr.com/ru/post/1656879/


All Articles