Abstract question about Dom Object as Value Object in Javascript
<p>I've got an image gallery where each item in the gallery has a unique ID I'm using to tie it to my backend so that I can run DB actions etc. I'm using the data attribute to hold the 'imageid' on the parent div of each image for example: data-imageid="168"</p>

<p>The image gallery items have alot of nested divs so on rollover/click I find myself doing alot of the below in order to run actions:</p>

<pre><code>$(this).parent().parent().attr('data-imageid');
</code></pre>

<p>It doesn't feel like a clean solution or the best performance wise. How are other people handling this? What's the best solution? Whatever the solution, this must be a problem solved everyday.</p>

<p>Edit: I realize my subject line is vague but it further explains where my heads at with this problem.</p>
