jquery - Cant get my added div removed -


i added elements page following code, works fine:

$("body").on("click", "#buttonadd", function(){     var vriend = "<div id='friends'><h4>jaap smit</h4><div class='unfollow'><a href='#' class='removefriend'>delete friend</a></div></div>";     $(this).parent().siblings(".currentfriends").append(vriend); }); 

however when try remove using following code, nothing happen...

$("body").on("click", "a.removefriend", function(){     $(this).closest('.vriend').remove(); });    

been trying quite time have no idea how fix it. ideas?

there nothing class vriend. may want remove #friends.

$("body").on("click", "a.removefriend", function(){     $(this).closest('#friends').remove(); }); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

c# - Abstract method in public abstract class implementing an internal interface doesn't compile? -

authentication - Mongodb revoke acccess to connect test database -