jQuery not working in chrome? If jQuery is not loading properly, try this:

This article was written by in March 8, 2014, & may not be posted on other sites!
Original source url for this article: jQuery not working in chrome? If jQuery is not loading properly, try this:

Is your jquery not working in chrome, safari or andriod? If jquery is not loading try this:
If jquery is not working, try the obvious first:

  1. Check all the spelling in your jquery document
  2. Try an alert box to see if your jquery file i loading at all: alert(‘it is working’);
  3. Check if you get any error messages in the browser console (use web developer tools / firebug)

The “document ready” jQuery function

We all learn to use the document ready function in jQuery. This means that jQuery code can only be executed after the document has loaded all html code, and is ready to be manipulated. However, all images and banners might not actually be fully loaded and this can cost some problems in browsers like Safari, Chrome and Android…
Document ready function looks like this:
$( document ).ready(function() {
// Your code
});

The “window onload” jQuery function is the solution

jQuery not working in chrome? If jQuery is not loading properly, try this:
If your jQuery code is not working in Chrome, Safari, Andriod or other browsers, it might be because the images and banners are not fully loaded only using the “document ready function”. To solve this problem use “window onload” function to ensure ALL data is fully loaded before your jQuery code i executed. (window onload can be used inside the document ready function)
Window onload looks like this:
window.onload = function() {
//your code
}

You can also try this jQuery code:
$(window).load(function(){
//your code
});

You can also use the window onload inside the document ready function:
$(document).ready(function() {
$(window).load(function(){
//your code
});
});

Spread the word

Facebooktwittergoogle_pluslinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *