.parent().parent().parent().... is there a better way?
Hello guys,
I have following code structure (pseudo code..keeping it short):
<div >
<textbox />
<table>
<thead>
....
</thead>
<tbody>
<tr>.....
</tbody>
<tfoot>
...
</tfoot>
</div>
In one of the cells, I have a button. To get to the top, I am right now doing
var parentDiv = $(sender.parent().parent().parent().parent()).find("#myDivID")[0];
This works..but I was wondering if there is a better way to go up the chain of elements till I find what I am looking for...?
Thanks in advance.