Does #search_form have dynamically loaded content? Is there any height set in CSS?
–
user113716Nov 7 '10 at 18:46

2

Is "#search_form" visible at the time that the JS is run? jQuery can't get width/height from a hidden element.
–
Blair McMillanNov 7 '10 at 18:47

1

@Blair - Are you certain? Here's an example using a hidden <div>. It gives the .outerHeight() correctly, at least in Safari.
–
user113716Nov 7 '10 at 18:50

2

With the information given I can't say for certain, but there are some times when block-level elements can have heights of 0 even when they have content. For instance, if all the content is inside one child element which is floated.
–
Tom SmilackNov 7 '10 at 18:56

1

Problem might be that he is looking for outer height of a form #search_form
–
SarfrazNov 7 '10 at 18:57

2 Answers
2

With jQuery you can only get the height of an element if it is visible. So make sure that it is visible at the time that your JS runs, or use one of the severalworkarounds if you need it to be hidden at the time.

As you mentioned in your comments, the div was hidden and then fading in.