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.
精彩评论