milandjukic88
milandjukic88

Reputation: 1115

JQuery how to acces td tag of row

i have list selected rows in table: var items = $('.trSelected',$('#formTable'));

My question is how to access each td tag in list if items (selected rows)?

Upvotes: 0

Views: 44

Answers (2)

michaelward82
michaelward82

Reputation: 4736

Try

var items = $('.trSelected', '#formTable'));

items.each(function () {
    $td = $("td", $this);
    // Now do what you like with $td...
});

Adding $this as a second parameter on the selector gives jQuery a context in which to search the DOM. Here $this is each <tr> from your first selector and jQuery will only look inside that element.

Upvotes: 1

letiagoalves
letiagoalves

Reputation: 11302

You can use each jQuery function to loop every row you got and select its td elements:

items.each(function(i, k) {
    var tds = $(this).find("td");
});

Upvotes: 1

Related Questions