<div class="divYS" id="dvProductsFilteredd">
<span class="s">Your Selection:</span>
<div id="dvFilter-Type" style="display:none">
<a class="s roundit" href="javascript:void(0);" id="aFilter-Type" onclick="ResetFilters(1);"></a>
</div>
<div id="dvFilter-Category" style="display:none">
<a class="s roundit" href="javascript:void(0);" id="aFilter-Category" onclick="ResetFilters(2);"></a>
</div>
<div id="dvFilter-Occasion" style="display:none">
<a class="s roundit" href="javascript:void(0);" id="aFilter-Occasion" onclick="ResetFilters(3);"></a>
</div>
<div id="dvFilter-Supplier" style="display:none">
<a class="s roundit" href="javascript:void(0);" id="aFilter-Supplier" onclick="ResetFilters(4);"></a>
</div>
<div id="dvFilter-SortExpression" style="display:none">
<a class="s roundit" href="javascript:void(0);" id="aFilter-SortExpression" onclick="ResetFilters(5);"></a>
</div>
</div>
我想得到dvProductsFilteredd的子div,它们使用JQuery显示属性块
答案 0 :(得分:3)
如果要明确检查display:block
属性,则可以使用过滤方法
$('#dvProductsFilteredd > div').filter(function() {
return $(this).css('display') === 'block';
}).length;
<强> Check Fiddle 强>
但是如果您只是想知道可见div的数量,那么您可以使用:visible
选择器。
答案 1 :(得分:1)
$('#dvProductsFilteredd').children('div:visible').length