Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i test if something is hidden with jQuery? [duplicate]

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?

like image 829
Favourite Onwuemene Avatar asked Oct 05 '12 11:10

Favourite Onwuemene


People also ask

How check element is hidden or not in jQuery?

To check if an element is hidden or not, jQuery :hidden selector can be used. .toggle() function is used to toggle the visibility of an element.

Is visible in jQuery?

The :visible selector in jQuery is used to select every element which is currently visible. It works upon the visible elements. The elements that are consuming space in the document are considered visible elements. The height and width of visible elements are larger than 0.

Is Div visible jQuery?

You can use .is(':visible') selects all elements that are visible.


1 Answers

Try

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

or

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

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

like image 110
gion_13 Avatar answered Oct 18 '22 11:10

gion_13