I want to select with jQuery the last element that it has pu
class before the element with which I launch this event knowing that I there are a lots of elements before and after the current that have this class
Here is an example :
<div class="pu" ></div>
<div class="pu" ></div>
<div class="pu" ></div>
<div class="current" ondragenter="myfunction();" ></div>
<div class="pu" ></div>
<div class="pu" ></div>
for this example, I want to select the last element that has pu
class before the div that has current class when the ondragenter
is launched.
I have this case because the div
are generated from server side
How can I achieve that?
Thanks!