Detect if html parent is hidden
You can just check if it's :hidden
, for example:
$(".selector:hidden").length > 0
//or
$(".selector").is(":hidden")
This works if the parent is hidden, or any parent, or the element directly...as long as the element itself has no dimensions, it's :hidden
.
Like this:
alert($('#test1').is(":visible"));
#test {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="test">
<div id="test1">
test
</div>
</div>
View on JSFiddle
jQuery uses offsetHeight. That works in most browsers. But you can check that without jQuery too.
$(foo).is(":hidden")
can figure that out for you in current jQuery versions.