Alex Rivera | Logout

How do I remove the height style from a DIV using jQuery?

Asked 2009-04-29T20:39:37.030
99

By default, a DIV's height is determined by its contents.

But, I override that and explicitly set a height with jQuery:

$('div#someDiv').height(someNumberOfPixels);

How can I reverse that? I want to remove the height style and to make it go back to it's automatic/natural height?

Edit
Report

2 Answers

21

maybe something like

$('div#someDiv').css("height", "auto");
answered 2009-04-29T20:53:28.290
14

To reset the height of the div, just try

$("#someDiv").height('auto');

answered 2009-04-30T05:13:57.917

Your Answer