views:

461

answers:

2

In IE7, this code isn't working properly:

  myJqObj.css("height", DEFAULT_HEIGHT);

When it runs, it seems to set the height of myJqObj to 0; However, if I query the height immediately after setting it, everything works fine:

  myJqObj.css("height", DEFAULT_HEIGHT); 
  myJqObj.height();

This also works:

  myJqObj.css("height", DEFAULT_HEIGHT); 
  myJqObj.width();

I'm sure if you run the previous code on its own, things will work fine. This is all happening in the midst of some fairly complex page building. There's obviously something in my js environment that's causing a bug. Anyone seen anything like this before? Any ideas where to start looking?

+1  A: 

I would check specificity. Have you verified your "myJqObj" object is specific enough for IE7?

When I set CSS that takes in FireFox and not in IE7, it's usually because I've set CSS for an element such as the <div id="mydiv"><p> element, and my <div id="mydiv"><p class="myclass"> height definition is being overridden by the first definition.

BPerreault
Thanks BPerrealt. Meaning make sure the height of myJqObj isn't being overidden by an ancester element?
morgancodes
Hi, yes, that's what I meant to say. It seems that IE will do that.
BPerreault
A: 

You might be looking in the wrong place.

Have you set myJqObj to float in the CSS? If so the height will actually be 0 since a floated element collapses.

Eystein