Tutorial jQuery Duplicate Plugin
$.fn.duplicate = function(count, cloneEvents) { var tmp = []; for ( var i = 0; i $.merge( tmp, this.clone( clon...
https://iskablogs.blogspot.com/2014/03/tutorial-jquery-duplicate-plugin.html
$.fn.duplicate = function(count, cloneEvents) {
var tmp = [];
for ( var i = 0; i < count; i++ ) {
$.merge( tmp, this.clone( cloneEvents ).get() );
}
return this.pushStack( tmp );
};
The .clone() function of jQuery will duplicate a set once, but what if you need multiple copies of the same set? You would have to do:
$(elem)
.clone()
.
var tmp = [];
for ( var i = 0; i < count; i++ ) {
$.merge( tmp, this.clone( cloneEvents ).get() );
}
return this.pushStack( tmp );
};
The .clone() function of jQuery will duplicate a set once, but what if you need multiple copies of the same set? You would have to do:
$(elem)
.clone()
.