The plugins site is currently in development.
We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.
Clonefield
jQuery.cloneField is a plugin that provides you with easy, dynamic form field (or any other DOM element, really) duplication and removal.
Its main purpose is to allow the duplication of a specific field (or fields) within a form, usually a file upload field (think gmail attachments).
It's really simple to use. Just create a button (<a>, <button>, <span>, <p>, whatever, really) immediately BEFORE the field(s) to clone and apply the clonefield plugin to it, passing the desired jQuery elements as the first parameter.
$("a#add").cloneField($("input#file"));It's that simple.
$.cloneField has a number of customizable parameters that you can pass as a second argument.
allowRemove: true, // allow removal of cloned elements; automatically creates removal button based on "add" button markup to create consistency
removeLabel: "Remove", // text for removal button
maxClones: 0, // maximum number of cloned fields
label: true, // create label for cloned elements, based on existing labels
labelAfter: '', // html to add after the cloned labels
labelWrap: '', // html to wrap cloned labels in
clone: true, // copy associated event handlers
after: '<br />', // html to add after the cloned elements
wrap: '', // html to wrap clone elements in
value: '', // default 'value' attribute for cloned elements
event: 'click', // event to trigger cloning of elements
startVal: 1, // start value of cloned elements
method: 'array', // either 'array' (for name="name[]") or 'number' (for name="name1", name="name2", etc...)
useCounter: false // use existing hidden field for keeping track of number of cloned elements