I have a simple table like this
<table id=tempTable>
<tbody>
<tr id=row_01>
<td>
<button onclick=btnclick(this); >Save Row</button>
</td>
</tr>
<tr id=row_02>
<td>
<button onclick=btnclick(this); >Save Row</button>
</td>
</tr>
</tbody>
</table>
function btnclick(e) {
var currentRow = $(e).parent().parent();
alert(currentRow.id);
}
I want to determine which row where the button clicked was placed. So I use some jquery method in btnclick() as you see abow. But sometime I don't know how deep level the button was placed in row (), so Im looking for a way to get an ancestor by tag <tr>
of a element.
Anybody help me, thanks?