Hi,

I have this HTML:

<div id="1" class="item clearfix">

  <div class="image"> ...</div>
  <div class="product">x ...</div>
</div>

<div id="2" class="item clearfix">

  <div class="image"> ...</div>
  <div class="product">x ...</div>
</div>

In the "product " DIV i have an " x " that x is an image icon, when
clicked it is suppossed do delete the product, i have it working very
good, but i don't know if the way i do to get the ID via javascript is
the best way or is a more simple way to do it.

My js to get the ID:


var productID = $(this).parent().parent().attr('id');

i have to use parent() twice because i have the " image " div above,
is there any simple way to get the ID?


If i use $('.item').attr('id'); it get's the first ID, so don't
work...

It works very good this way, but i want to change the order of the
div's i need to change the JS too :S


Thanks in advance for any tips ;)

Reply via email to