I have a div which is defined via a this. Imagine it is the var div below:
<td itemid='desired number'>
<div>div 1</div>
<div class="action">div 2</div>
</td>
Given the var div how can I work out the itemid attribute of the td which contains it. Note, I do not want a solution which directly accesses the itemid attribute, it has to the itemid which is containing div 2.
var div = $('.action')
I’ve tried using parent() with no success.
Thanks.
Try
Proof of concept: http://jsfiddle.net/AwM56/