I have this strange bug. My jQuery code works in Firefox, and also when I paste it in Safari's or Chrome's console.
I have it loaded first, and I'm pretty sure it reads it cause alert is showing. Do you see anything wrong with the code that might affect this issue?
$(document).ready(function(){
var questionOne = $('.questions').find('.question').eq(0);
questionOne.removeClass('hide');
});
I don't have any kind of errors in console. I tried loading the script I think in every possible way that's on the internet.
Your code seems right, but as other may have said that if object ".questions" have not been rendered then you won't be able to find it. I had a problem like that before and this is what I did:
$(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);
});
Or:
$(document).ready(function () {
setTimeout(function () {
var questionOne = $('.questions').find('.question').eq(0);
questionOne.removeClass('hide');
}, 100);
});