- The below code will help to identify if the element is visible or not:
[code language=”javascript”]
$(element).is(":visible");
[/code]
However, :visible will also check if the parent elements are visible.
[code language=”javascript”]
// Matches all element that are hidden
$(‘element:hidden’)
// Matches all element that are visible
$(‘element:visible’)
[/code]
- To check the display property of single element and not the parent element we have third alternative
[code language=”javascript”]
if($(element).css(‘display’)==’none’){
// element is hidden
}
[/code]
