How to check if an element is hidden using jQuery?


If we are writing some code using jQuery and want to know if a particular element in your page is visible or hidden you can do that using is() method,

Example:

<div id="hiddenEle" name="hiddenEle" style="display:none">This div is hidden</div>
<div id="visibleEle" name="visibleEle" style="display:block">This div is visible</div>
console.log($('#hiddenEle').is(":visible"));
console.log($('#visibleEle').is(":visible"));
Output:

false
true

Example - jQuery check if element is hidden
Example - jQuery check if element is hidden

✌️jsfiddle: https://jsfiddle.net/0wxy8ect/4/