Ask questions and get good answers on mb.jQuery.components

i would like to know if it possible to use "if condition" in jquery.

i need to write in jquery this condition

if #mydiv height > 0 ( function to close the div)

can someone help me to translate this in jquery? thanks

asked Apr 21 '10 at 12:35

f9650's gravatar image

f9650
112


Use a custom selector

// custom selector jQuery.expr[':'].over = function(o,i,m,s){ return $(o).height() > +m[3]; };

//usage $('#mydiv:over(400)').hide();

answered Apr 21 '10 at 15:48

user-182%20%28google%29's gravatar image

user-182 (google)
111

Of course you can:

if( $("#[myDivID]").outerHeight()>0 ){
   doSomething();
}

answered Apr 21 '10 at 13:19

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

Your answer
toggle preview

jQuery main site - Matteo Bicocchi