【发布时间】:2013-10-20 15:11:36
【问题描述】:
如何只选择第一级 .block 而不选择任何子级?
$('.block:not("Children of this here")')
<div class="block"> <!-- this -->
<div class="block"> <!-- not this -->
<div class="block"> <!-- not this -->
</div>
</div>
</div>
<div class="block"> <!-- and this -->
<div class="block"> <!-- not this -->
<div class="block"> <!-- not this -->
</div>
</div>
</div>
【问题讨论】:
-
你给他们一个
block的类有什么原因吗?如果是给所有样式设置样式,你知道继承和多重选择器,即(.block, .date, .info { color: blue; }) -
@alex,对于这种情况,假设重命名块是不可能的(谢谢,Drupal)。因此,这个问题的难度。