JQuery element length not working in Chrome #JQuery_tips

Updated July 12, 2013 ‚óŹ 701 views
If you are trying to get the real dimension of an image using jquery, it might be working in Firefox but not in Chrome. The reason is you might be using document.ready function.

When you use document.ready, the image is not loaded yet in Chrome thus the image, length for example, cannot be determine.

You have to use $(window).load() function so the function waits until the image is loaded.


Our Terms of Use and Privacy Policy have changed.
By continuing to use this site, you are agreeing to the new Privacy Policy and Terms of Use.