This jQuery Plugin is a simple plugin that clones the HTML Dom Element.
- Put
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
. - Put
<script src="/assets/js/jquery.simpleClone.min.js"></script>
after jQuery library. - Done.
Coding is quite simple. The options are only simple, so you won't get lost.
<div>
<div class="simpleClone-clnElem">
TEXT.
</div>
</div>
<div class="simpleClone-btnWrap">
<button type="button" class="addBtn">
+ Add
</button>
</div>
<script>
(function ($) {
'use strict';
$('.addBtn').simpleClone();
})(jQuery);
</script>
<script>
(function ($) {
'use strict';
$('.addBtn').simpleClone({
copyValue: false
});
})(jQuery);
</script>
Options | Description |
---|---|
copyValue default: true |
. |
cloneLimit default: false |
. |
limitMessageClass | . |
limitMessageText default: Maximum count has been reached. |
. |
targetClass | . |
addButtonWrapClass | . |
removeButtonClass | . |
removeButtonText default: Remove |
. |
Function | Description |
---|---|
filterCloneElement default: null |
. |
onClone default: null |
. |
onComplete default: null |
. |
onRemove default: null |
. |
onCompleteRemove default: null |
. |
MIT License
Copyright (c) 2020 Kaleid Pixel