I want width of a div element which is specified by developer.
Means if you write $('body').width(), it will provide you width in px , whether you have specified it or not.
I need width of div specified in CSS/JavaScript but not which is calculated by jQuery (which was not actually specified but was inherited).
If not width is specified then I need to know.
The code below will loop through all stylesheets as well as the matching element’s style property. This function will return an array of widths.
Fiddle here
There is one issue that I can see though as multiple selectors can be specified in the selectorText i.e.
In these cases the id passed in as an argument will not match the selectorText property. Maybe someone can come up with a regex expression that will match the specified id 🙂