How do i test if something is hidden with jQuery?

JqueryVisibility

Jquery Problem Overview


> Possible Duplicate:
> Testing if something is hidden with jQuery

In jQuery, suppose you have an element of some kind that you're hiding and showing, using .hide(), .show() or .toggle(). How do you test to see if that element is currently hidden or visible on the screen?

Jquery Solutions


Solution 1 - Jquery

Try

$("some-selector").is(':hidden');

or

$("some-selector").is(':visible');  

Here are the docs for the http://api.jquery.com/visible-selector/">`:visible`</a> and the http://api.jquery.com/hidden-selector/">`:hidden`</a> selectors.

Solution 2 - Jquery

$('.target').is(':hidden') // returns true if the element is hidden
$('.target').is(':visible') // returns true if the element is visible

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFavourite OnwuemeneView Question on Stackoverflow
Solution 1 - Jquerygion_13View Answer on Stackoverflow
Solution 2 - JqueryBruno VieiraView Answer on Stackoverflow