Hi I have one hidden div and inside it i have visible span. I want to alert some text if span does not have display none property.
<head>
<script type="text/javascript">
$(function() {
if($('span').is(':visible')){
alert(0)
}
})
</script>
</head>
<body>
<div class="fa" style="display:none">
<span>sdf</span>
</div>
</body>
The reason your alert doesn’t fire is that your
spanisn’t visible. The fact that it is contained within an element that hasdisplay: nonemeans that it will not be shown. If you specifically want to check if it isdisplay: noneitself, usecss.