Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery(document).ready() does not fire [closed]

Does anyone know why jQuery document ready might not fire on a website? I put exactly this script in footer and it simply doesn't fire (jQuery 1.8 is included in head section):

<script type="text/javascript">
jQuery(document).ready(function() { 
     alert('test');
     jQuery("#slideshow iframe").each(function(){ 
          alert('test');
     });
});
</script>

There are no Javascript errors, console is empty and when I run this in Firebug's console it works:

jQuery("#slideshow iframe").each(function(){ 
     alert('test');
});
like image 896
Atadj Avatar asked Jan 16 '23 12:01

Atadj


1 Answers

While that was not the case in this specific instance, one very annoying way in which this can happen is jQuery bug 10251: an error in a $(document).ready() callback will prevent all callbacks registered after it from running. (In this case there will be a Javascript error, it might look completely unrelated, though.)

like image 138
Tgr Avatar answered Jan 18 '23 22:01

Tgr