by Stian

Check if element is hidden with jQuery

 

Expert solutionJust another quick jQuery help post; how can I check if an element is visible or hidden using jQuery?

To check this for a single element, you can write:

[csharp]// Checks for display:[none|block], ignores visible:[true|false]
$(element).is(“:visible”)[/csharp]

You can also have a selector which gives you all hidden elements:

[csharp]// Matches all elements that are hidden
$(‘element:hidden’)[/csharp]

or of course all visible elements:

[csharp]// Matches all elements that are visible.
$(‘element:visible’)[/csharp]