<div id="tab">
<div class="" style="margin: 10px;">
<div id="someVerylongId1" style="height: 400px; position: relative;">
</div>
</div>
<div class="" style="margin: 10px;">
<div id="someVerylongId2" style="height: 400px; position: relative;">
</div>
</div>
<div class="" style="margin: 10px;">
<div id="someVerylongId3" style="height: 400px; position: relative;">
</div>
</div>
<div>
我想选择所有没有指定id或检查任何其他属性的div,这是否可能做到?这是我的尝试:
$("#tab div div")
但看起来选择的不是完全正确的。需要帮助。
问题是,我的选择器返回的元素比应该返回的更多。
$("#tab > div > div")
应该可以解决问题,尽管不是很确定。 - Quasdunk$("#tab div div").length == 3
是否正确。 - Tim Rogers$("#tab").length==1
。 - WTKif($('#tab').length)
。不需要等号。 - daryl