我希望size属性的长度包含“small”
<div class="handle" id="parentSmall-1" value="0" size="small">
<div class="csd a" id="child1"></div>
<div class="csd a" id="child2"></div>
</div>
<div class="handle" id="parentSmall-2" value="1" size="small">
<div class="csd b" id="child3"></div>
<div class="csd b" id="child4"></div>
</div>
<div class="handle" id="parentLarge-1" value="2" size="large">
<div class="csd c" id="child5"></div>
<div class="csd c" id="child6"></div>
</div>
<div class="handle" id="parentLarge-2" value="3" size="large">
<div class="csd d" id="child7"></div>
<div class="csd d" id="child8"></div>
</div>
答案 0 :(得分:2)
尝试,
$('[size="small"]').length
答案 1 :(得分:0)