html - jQuery incorrectly reports a width of zero -


I try to reach the breadth of some elements using the jQuery .width () function I am doing, but sometimes the return value is 0 , when I do not expect it. Is this a known issue? Is an element working for it, perhaps? If there are limitations, how can I work around them?

If you are working with images, then instead of $ (document) Code> $ (window) .load () Make sure to run the code .ready () , like this:

  $ (window) .load (Function () {var width = $ ("img"). Width ();}); Otherwise, make sure the element is visible, not hidden elements or (it will return to 0 for both). 


Comments