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

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -