Wednesday, 28 August 2013

Appending a copy of a divs contents without doubling

Appending a copy of a divs contents without doubling

I want to add another copy of a div or just it's contents below the
original. Using .clone() it will double every time. I want to add one more
of the same every time. Can't figure it out. Any suggestions. Code is
currently.
$("#element").click(function(){
var newElement = $("#element").clone();
$("#element").append(newElement);
});

No comments:

Post a Comment