Options - Yapapaya/jquery-cloneya GitHub Wiki


Table of Contents


Default

	
	$clonecontainer.cloneya({
            minimum		: 1,
            maximum             : 999,
            cloneThis		: '.toclone',
            valueClone		: false,
            dataClone		: false,
            deepClone		: false,
            cloneButton		: '.clone',
            deleteButton	: '.delete',
            clonePosition	: 'after',
            serializeID         : true,
            ignore		: 'label.error',
            preserveChildCount  : false
        });

Details

minimum

(default: 1)

The minimum number of clones allowed. The event minimum.cloneya is triggered when these many clones are left. Only trigerred while deleting.

maximum

(default: 999)

The maximum number of clones allowed. The event maximum.cloneya is triggered when these many clones are created. Only triggered while cloning.

In Versions < 1.0 was known as limit

cloneThis

(default: '.toclone')

A valid jQuery selector for the element that'll be cloned. Must be a child of the element that CloneYa was instantiated on.

valueClone

(default: false)

Whether to copy the values of form inputs inside the clonable.

dataClone

(default: false)

Whether to copy the jQuery.data of the cloneable.

deepClone

(default: false)

Whether to copy the events too (very deep copying)

cloneButton

(default: '.clone')

A valid jQuery selector for the element that triggers cloning. Must be a child of the cloneThis selector

deleteButton

(default: '.delete')

A valid jQuery selector for the element that triggers clone deletion. Must be a child of the cloneThis selector

clonePosition

(default: 'after')

The position, with respect to the cloneable, where the clone will be inserted.

Possible values:

  • 'before' before the clonable
  • 'after' after the clonable
  • 'start' before the first clone (to do, not implemented yet)
  • 'end' after the last clone (to do, not implemented yet)

serializeID

(default: true)

Whether to numerically increment the ids of the inputs to maintain uniqueness

serializeIndex

(default: false)

Whether to numerically increment the index of the inputs names to maintain uniqueness

ignore

(default: 'label.error')

A valid jQuery selector for elements that will not be copied (i.e. ignored) into the new clone.

preserveChildCount

(default: false)

Assume a cloneable parent that has a child that is cloneable as well.

Assume that the parent is cloned (event B) after the child is cloned(event A).

This option decides whether the new parent clone will contain the number of children created before event A (preserveChildCount: true) or after event A (preserveChildCount: false).