When working with jQuery, I have noticed that both $('#foo').height()
and $('#foo').css('height')
will return a value regardless of whether a height property is explicitly set using CSS. Is there a way to determine if an element does not have a specific height set in CSS and is simply adjusting based on its content?
I created an example to illustrate this concept: http://jsfiddle.net/Enn6p/2/
UPDATE
To further clarify my question, I have observed that $('#foo').css('min-height')
and $('#foo').css('max-height')
return an empty string if not explicitly set. My goal is to determine whether a specific height
value is set through CSS or not.
SCENARIO
I am developing a script to equalize the height of floated elements. The script identifies the tallest element and applies that height to all elements in the group. In some instances, certain elements already have a set height, while others adjust dynamically. I now need to implement the functionality to revert all elements to their original heights. To achieve this, I must determine if an element originally had a height set or was set to "auto". By storing the original value in the element's data collection, I can later use it to restore the original height.