views:

57

answers:

2

Dear jquery experts,

Is there any way to access a tr from an input of a tr above without adding row specific id's or classes?

<table>
<tr><td>just another row</td>
<tr><td><input name="inputToSerachFrom" type="text" /></td><tr>
<tr><td>I want to acces this row without adding id's or classes</td><tr>
<tr><td>just another row</td>
</table>

var rowINeed = $("input[name=inputToSerachFrom]").closest("tr").parent().noIdea();

Jan

+1  A: 
$("input[name=inputToSerachFrom]").closest("tr").next('tr:first')
David Hedlund
+1  A: 

To access the next tr from the input, without using any IDs, you can use this:

var nextRow = $(this).parents('tr').next();
Cocowalla
This is indeed the way to go. Jan
Jan Hoefnagels