How to know the status of the div in jquery?

user601367 picture user601367 · Apr 15, 2011 · Viewed 23k times · Source

i am developin one application using jquery. i want to know the status of the div wheather the div is show state or hide state something like this:

if($("#test").show()==true) 
{
//some operration
}
else
{
//some operration
}

alert($("#test").show()==true); always shows false.

please help me...

Answer

AndrewR picture AndrewR · Apr 15, 2011

You can use is() and the :visible selector.

if( $('#test').is(':visible') ) { ... }