Hello I am trying to the get the count of div
which has style
display
block
.
<div class="wrapper">
<div class="sub" style="display:none">text</div>
<div class="sub" style="display:block">text</div>
<div class="sub" style="display:none">text</div>
<div class="sub" style="display:block">text</div>
<div class="sub" style="display:none">text</div>
</div>
jQuery -
$(document).ready(function(){
$(".wrapper").each(function(){
var wrapLength = $('.sub').length;
$(".sub").each(function(){
if($(".sub").css("display","none")){
wrapLength = wrapLength - 1;
}
});
alert(wrapLength);
});
});
Now I am getting the count as 0
but I should get the count as 2
. Please help.