javascript - remove icon not working in anchor tag -
i want remove added list using remove icon in anchor tag, removing , again opening list
$('.list').on("click", ".remove", function () { $(this).parent().remove(); });
<ul class="list"> <li><a href="#">list[i]<i class="fa fa-remove remove"></i></a></li> </ul>
you removing a
, use closest
remove list item
$('.list').on("click", ".remove", function () { $(this).closest('li').remove(); });
Comments
Post a Comment