Search code examples
jqueryhtmlhideshowstatus

How to know the status of the div in jquery?


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...


Solution

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

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