开发者

getting a specific adjacent element in jquery

if I have the following table:

<tr class="alternate">
    <td>{$order.titel}</td>
    <td>{$order.auteur}</td>
    <td>&euro;{$order.prijs}</td>
    <td>{$order.aantal}</td&开发者_Go百科gt;
    <td>&euro; {$order.aantal*$order.prijs}</td>
<tr>

and inside jquery I currently have the 4th td selected, how can i get the data from within the first td, keeping in mind that I start looking from the 4th td (eg. the 4th td is 'this')?


var first = $(this).siblings().first();

Or, for one of the other elements:

var second = $(this).siblings().eq(1);


You can use the prev() method which returns the preceding sibling.

var first = $(this).prev().prev().prev();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜