Using jQuery copy plugin from CSS Tricks

Posted by ftntravis on Stack Overflow See other posts from Stack Overflow or by ftntravis
Published on 2012-11-07T22:57:29Z Indexed on 2012/11/07 22:59 UTC
Read the original article Hit count: 292

Filed under:
|
|

I'm trying to use this plugin that CSS Tricks suggests.

http://css-tricks.com/snippets/jquery/duplicate-plugin/

Shouldn't the following allow me to click a button and create a copy?

$.fn.duplicate = function(count, cloneEvents) {
var tmp = [];
for ( var i = 0; i < count; i++ ) {
    $.merge( tmp, this.clone( cloneEvents ).get() );
}
return this.pushStack( tmp );
};
$('.copy').click(function() {
$('#form li').duplicate(5).appendTo('#form');
};

It's not working when I click it :(

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-plugins