Skip to content Skip to sidebar Skip to footer

Appending A "delete Link" To Cloned Elements With JQuery

All, I need to add a 'delete' link to the end of all of my cloned sections, but not the source of the cloned material. This is what I have so far Need something like this: Step One

Solution 1:

Try this:

 var deleteLink = $("<a>delete</a>");
 deleteLink.appendTo(copy);
 deleteLink.click(function(){
     copy.remove();
 });

Note that you'll need to style the delete link appropriately since it doesn't have an href.

JSFiddle: http://jsfiddle.net/5QBLB/


Post a Comment for "Appending A "delete Link" To Cloned Elements With JQuery"