how to check element visibility in jquery?

example of element exists and it’s not visible

<div id="test">
  <div id="test_1" style="display:none">
    Hello World!
  </div>
</div>


jQuery code:
  if ($('#test_1:visible').length > 0)
{
         alert('the element is visible');
}
    else
{
         alert('the element is not visible');
}

Comments

Leave a Reply

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