One way to do it:
$(#table tr).each(function(){
$(this).find(td:eq(2)).dosomething;
});
Does anyone have a quicker way to do it?
Jacky-10 wrote:
Dear all,
If I want to select the 3rd column of the table, (e.g. 3 rows)
$(tr td:eq(2)) would returns only one td.
$(tr).find(td:eq(2))
Is .each redundant?
Does .find support functions like this?
$(#table tr).each.find(td:eq(2))(function(){
$(this).dosomething;
});
Jökull wrote:
One way to do it:
$(#table tr).each(function(){
$(this).find(td:eq(2)).dosomething;
});
Does anyone have a quicker way to do it?
You actually can do it this way:
$('trtd:nth-child(3)');
The reason why eq(N) returns just one, is that you're telling it grab the
nth one you find out of a set.
The code I pasted above grabs the nth CHILD of the tr, so it will return
what you want.
Hope that helps :)
Jacky-10 wrote:
Dear
I'm no expert, but it seems $('tr td:eq(2)') is like select the third td
that is a child of tr. Whereas $('tr').find('td:eq(2)') is like for each
tr, select the third td. It sounds like the second one is what you want.
--Erik
On 1/11/07, Jacky [EMAIL PROTECTED] wrote:
Dear all,
If I want to
Dear all,
If I want to select the 3rd column of the table, (e.g. 3 rows)
$(tr td:eq(2)) would returns only one td.
$(tr).find(td:eq(2)) would returns 3 td.
Is that :eq(2) is applied to the whole trtd set? Is that correct?
--
Best Regards,
Jacky
網絡暴民 http://jacky.seezone.net