views:

1111

answers:

1

Lets say I have something like this:

<tr>
<td><input type="text" /></td>
<td>Somevalue</td>
<td><intput type="text /></td>
</tr>

I am in the event handler for a keypress in the first text box. I want to find the next td which has a text box in it if it exists using jQuery.

+4  A: 

Something like this should work (assuming this is the input).

var next = $(this).parent().next("td > input[type='text']");
tj111
$(this).parent().next("td:has(input[type='text'])");Is what I ended up with, I found that using > did not work, but that :has did.
Ross Goddard
interesting, glad it worked out though.
tj111