99Problems 99Problems - 1 year ago 57
jQuery Question

is.(':visible') == true on not-visible parent

I have:

<div style="display:none;">
<div class="checkMe"></div>

when I now check
if it is visible..

if($('.checkMe').is(':visible')) { ...

it is true although it is not

is there a way to achieve the check, without checking the parent-div?

Answer Source

It is returning the correct value.

if ($('.checkMe').is(':visible')) {
} else {
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<div style="display:none;">
  <div class="checkMe"></div>