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?

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

You can use the “hidden” and “visible” selectors.

 $('element:hidden')
 $('element:visible')

Leave a reply