Andrejs Cainikovs
Andrejs Cainikovs

Reputation: 28434

Reading CSS height/width value are Xpx in FF while 'auto' in IE

Div box dimensions are measured using jQuery with following code:

$(document).ready(function(){
  var h = $("#testbox").css("height");
});

In FF it gives for me 270px, in IE auto. How can I measure actual div height/width in IE without changing it's css?

Upvotes: 4

Views: 346

Answers (2)

andres descalzo
andres descalzo

Reputation: 14967

try putting the css for # testbox

#testbox {
   height: 0px; 
}

Upvotes: 1

redsquare
redsquare

Reputation: 78667

use .height() and .width().

var h = $("#testbox").height();
var w = $("#testbox").width();

Upvotes: 5

Related Questions