I want to remove each selected element with same class element. My jquery coding is given bellow
$(".del_layer").each(function(){ $(this).click(function(){
$(this).parent().remove();
});
});
my html structure is
<li class="select_layerList" data-refind="0">
<img width="20px" src="tmp_card_imgs/a.png">
Layer 0:Image
<span class="del_layer" style="cursor:pointer;">X</span>
</li>
<li class="select_layerList" data-refind="0">
<img width="20px" src="tmp_card_imgs/b.png">
Layer 0:Image
<span class="del_layer" style="cursor:pointer;">X</span>
</li>
But each function is not working. How can I solve this
.click()inside the.each().