.entry:first .children(':gt(0)')
可能是
.entry:first > :gt(0)
. 这个
>
是直接子组合子,当然
:gt(0)
是“大于索引0”。
但我认为这不是你想要的。您在评论中说:
我正在尝试选择第一个
.entry
加载的页面源的div。
:gt(0)
将
跳过
第一个这样的元素,而不是选择它。要选择所需内容,请执行以下操作:
.entry:first > :first
:
$(".entry:first > :first").css({
color: "green",
fontWeight: "bold"
});
<div class="entry">
<span>first child of first .entry</span>
<span>second child of first .entry</span>
</div>
<div class="entry">
<span>first child of second .entry</span>
<span>second child of second .entry</span>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>