html - deleting the parent div using jquery -
i have jquery scripts aimed @ deleting parent div. however, delete button doesn't appear button , won't delete parent div. using jquery mobile.
here jquery:
$(".delete_content").click(function() { $(this).closest(".content_container").remove(); });
here html:
<div class='content_container'> <a class='delete_content' data-role='button' data-icon='delete' data-inline='true' data-iconpos='right'> delete </a> </div>
$(".delete_content").click(function() { $(this).parents(".content_container").remove(); });
you need use .parents
, not .closest
Comments
Post a Comment