I have an element with a class, the class has a set width. Later I change the width with $(‘#elm’).width(100); now, even later, I want to go back to the original value. Is there a way to get what the original value is from the class definition itself rather than store a bunch of globals with the values I need.
Thanks,
Justin
I’d suggest nikc’s answer, but you could always do
$('#elm').removeAttr("style");if you want to wipe any styles your scripts have added, and return them to the CSS values you’ve specified.Really, though, you should be leaving the styling out of the code and just adding, removing and toggling various classes.