I've added JavaScript code to my Drupal 7 theme, but it fail to run as it's expected because css are not properly applied when my function is fired.
So I've tried a minimal implementation to check what's happening.
jQuery(document).ready(function($) {
alert("Start");
}
alert()
is fired before the page is fully loaded (i.e. all titles are missing).
How can I prevent this?
In order execute a script after everything has fully loaded you want:
$(window).load(function(){
alert('hello');
});
jQuery.ready() executes as soon as the DOM is ready, which is usually before external resources have loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With