假设我有这样的 HTML:
<span class="buttonNo1">1</span>
<span class="buttonNo2">2</span>
<span class="buttonNo3 clicked">3</span> //Suppose this button is clicked
<span class="buttonNo4">4</span>
<span class="buttonNo5">5</span>
<span class="buttonNo6">6</span>
<span class="buttonNo7">7</span>
现在,我想获取单击时className
具有该类的跨度的下两个相邻兄弟姐妹的。clicked
clicked
一种简单的方法是。
$(".clicked").click(function(e){
console.log($(this).next().attr('class'))
console.log($(this).next().next().attr('class'))
})
怎么办.nextUntil()
?