开发者

best way to select a first sibling's first child in jquery?

I'm trying to select the first child of a first sibling in jquery but having开发者_StackOverflow some trouble getting it right:

<tr class="foo"></tr>
<tr>
  <td>

I have a handler attached to tr.foo and I want to do something to the td, but I'm not getting the selector right.


Try this:

$("tr.foo").next("tr").children("td").first()

Check out the JQuery traversing documentation.


The selector tr + tr td selects the td that has a tr parent that is preceeded by another tr.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜