Is t...">

How to get the original height of an HTML element?

I have a div:

<div id="div" style="height:150px; border:solid thin blue;"></div>

Is there any way to get the div height of the original ? The div is resized, so the user can resize it before loading the code.
Note: my code is a jQuery plugin, so I don’t know what happened to the element before my plugin (so please do not tell me to store the height in the element data ...)

jqFiddle in this demo, I want to get 150 after resizing the div.
Any help would be greatly appreciated!

+3
source share
3 answers

No, because the method resizable()overrides the inline style height.

.

, , div :

var originalHeight = $('#div').height();
$('#div').resizable();

$('#cmd').button().click(function(){
    alert(originalHeight);
});
+2
originalHeight=0;
$(document).ready(function()
{
    originalHeight= $("#div").height()
});
0

, DOM, , init ? , , init, , .ready(), , .

div, jquery-ui?

, ajax, , .

0

All Articles