How do I check if an element is hidden in jQuery?

Created by Tsvetomir TsonevLinked to 8.6m issues across 76 teams

tl;dr

You can check if an element is hidden in jQuery using the .is(":hidden") method. For example, if you wanted to check if an element with the ID of myElement was hidden, you could use the following code:

if ($('#myElement').is(":hidden")) { // Element is hidden } else { // Element is not hidden }