The <div>s are dynamically created using spry framework:
<div class = "container" spry:region="pv1" spry:repeatchildren="pv1" >
<div id="{pv1::order/@nr}">
<!-- content -->
</div>
</div>
So the div is a number from 1 to x.
The context menu is attached to the class "container":
<script type="text/javascript">
SimpleContextMenu.setup({'preventDefault':true, 'preventForms':false});
SimpleContextMenu.attach('container', 'CM1');
</script>
I can't say in advance how many divs there will be because the whole website is created dynamically, that's why I need to find a way to read the right <div> when using the context menu there.