Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery - Find the next element which has a specific child

Tags:

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.

like image 452
Ross Goddard Avatar asked Mar 05 '09 15:03

Ross Goddard


1 Answers

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

var next = $(this).parent().next("td > input[type='text']");
like image 116
TJ L Avatar answered Oct 03 '22 00:10

TJ L