jQuery Tip: How to test if something is hidden with jQuery

x theme

We know that it is possible to toggle the visibility of any element in jQuery. We use .toggle(), .hide() or .show() for doing this. But what you will do if an element has been shown or hidden using jQuery?

 

I’m sharing a simple tip for how to test if something is hidden with jQuery.

$(your_element).is(":visible");

The above line of code checks if display is block or none, and ignores that visible is true or false.

Leave a Reply

Your email address will not be published. Required fields are marked *