Organizational Research By

Surprising Reserch Topic

how to Checking if an element is hidden


In jQuery, it is possible to toggle the visibility of an element, using the functions .hide(), .show() or.toggle().

Using jQuery, how would you test if an element is visible or hidden?

asked Jun 30, 2015 in JAVASCRIPT by rajesh
0 votes
75 views



Related Hot Questions

2 Answers

0 votes

Since the question refers to a single element, this code might be more suitable:

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

Same as twernt's suggestion, but applied to a single element.

answered Jun 30, 2015 by rajesh
0 votes

You can use the hidden selector:

// Matches all elements that are hidden
$('element:hidden')

And the visible selector:

// Matches all elements that are visible
$('element:visible')
answered Jun 30, 2015 by rajesh

...