Ravleen Kaur Ravleen Kaur - 6 months ago 10
Javascript Question

Element is hidden not working with css property

I want to check if an element is hidden but the code below is not working properly.

if ( $(element).css('display') = 'none' ){
// element is hidden
}

Answer

hey in your code you have to put ==

if( $(element).css('display') == 'none' ){

}

Also you can use

$("#idElement").is(":visible") 
Comments