Explanation
It's surprising that this question has never been asked before, but here we are... Please don't confuse it with this other question.
I'm attempting to save the height of an element using jQuery's data
method so I can retrieve this value later and reset the original value on a specific element.
However, when I try to retrieve the height of my element, it gives me the computed height rather than the actual CSS value. While this is usually useful in other scenarios, I specifically need the exact value specified in my stylesheet, whether it's 100%, auto, or 10px...
My Question
Is there a way to obtain the precise CSS (non-computed) value of an element using jQuery?
For example (CSS):
#wrapper {
height: auto;
}
And JS:
// Returns 'auto' not computed value...
var height = $('#wrapper').height();
Further Information
The only solution I can think of at the moment is to simply remove the inline style
tag from my element, which will eliminate any styles applied by jQuery. The downside to this approach is that it will remove all styles, not just the specific one I'm interested in...