50

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?

Community
  • 1
  • 1
Favourite Onwuemene
  • 3,847
  • 8
  • 25
  • 42

2 Answers2

44

Try

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

or

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

Here are the docs for the :visible and the :hidden selectors.

gion_13
  • 39,371
  • 9
  • 93
  • 105
9
$('.target').is(':hidden') // returns true if the element is hidden
$('.target').is(':visible') // returns true if the element is visible
Bruno Vieira
  • 3,794
  • 1
  • 21
  • 35