Check if element is hidden


If you work with JavaScript for a while you'll most likely have wanted to know whether a certain element is visible or not. While it's easy if you apply a class like hidden or a style like display: none;, it can get tricky with nested elements. jQuery to the rescue!


Assuming you have an element like this:

<div id="myElement">
  Am I hidden or not?

You can simply check for its visibility by using this code:



Please sign-in to post a comment