0

Says I have DOM like below :

<div>
    <span>a</span>
</div>
<div>
    <span>c</span>
</div>
<div>
    <span>b</span>
</div>
<div>
    <span>a</span>
</div>
<div>
    <span>b</span>
</div>

How to remove duplicated element above? I thought of foreach, text() and remove() but I don't know how to do the comparison.

$('div').foreach(function(){
// how to compare here?
$(this).find('span').text();
});
Jamie Anderson
  • 1,453
  • 3
  • 13
  • 13

0 Answers0