Why is the height of my search form 0? It's at least 20px high.
jQuery(function($) { // Document ready
var s_height = $("#search_form").outerHeight(); // Height of searchform
alert(s_height) // 0
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 several workarounds if you need it to be hidden at the time.
As you mentioned in your comments, the div was hidden and then fading in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With