On Nov 12, 2008, at 9:05 AM, Rik Lomas wrote:

This is completely untested, but this is a bit simpler:

$('#PG1_L03-table').find('td:eq(3), td:eq(5), td:eq(7),
td:eq(9)').find('input').bind......


That won't work, because it'll only select the 4th, 6th, 8th, and 10th TD.

2008/11/12 ggerri <[EMAIL PROTECTED]>:
have the following selector and wonder how this could be simplified?
:confused:

$('#PG1_L03-table td:nth-child(3) input, #PG1_L03-table td:nth- child(5) input, #PG1_L03-table td:nth-child(7) input, #PG1_L03-table td:nth- child(9)
input').bind......

need to bind an event to all input fields of col 3, 5, 7 and 9 but only for
table PG1_L03-table.


You could try this:

$('#PG1_L03-table td:nth-child(2n+3)').bind ...

That will also get cols 11, 13, etc., so if you need to stop at 9, let me know and I'll think about it some more.

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to