How to check if an element is hidden in jQuery?

There are many ways to check if an element is hidden using jQuery. I will list out mostly used methods in this post.

Let’s say the element has id=”test”. Then the code will be,

Method 1: 

Working example for the above method is here:

Above snippet will see for the element is hidden or not, if hidden it gives an alert saying ‘yes hidden’.


Method 2: 

The second method is basically checking the CSS propery display is none or block.

Working example for the method 2 is here:

Same like the above method this example also gives an alert ‘yes hidden’ if the display is none.

I hope this could have helped you.

Related Posts

Leave a Reply