Skip to content

This jQuery Plugin is a simple plugin that clones the HTML Dom Element.

License

Notifications You must be signed in to change notification settings

kaleidpixel/jquery-simple-clone

Repository files navigation

jQuery simple clone plugin

This jQuery Plugin is a simple plugin that clones the HTML Dom Element.

How To Install

  1. Put <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>.
  2. Put <script src="/assets/js/jquery.simpleClone.min.js"></script> after jQuery library.
  3. Done.

Document

Coding is quite simple. The options are only simple, so you won't get lost.

Basic markup

<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>

Don't want to copy the value.

<script>
    (function ($) {
        'use strict';

        $('.addBtn').simpleClone({
            copyValue: false
        });
    })(jQuery);
</script>

Options

Options Description
copyValue
default: true
.
cloneLimit
default: false
.
limitMessageClass .
limitMessageText
default: Maximum count has been reached.
.
targetClass .
addButtonWrapClass .
removeButtonClass .
removeButtonText
default: Remove
.

Callback function

Function Description
filterCloneElement
default: null
.
onClone
default: null
.
onComplete
default: null
.
onRemove
default: null
.
onCompleteRemove
default: null
.

License

MIT License
Copyright (c) 2020 Kaleid Pixel

About

This jQuery Plugin is a simple plugin that clones the HTML Dom Element.

Resources

License

Stars

Watchers

Forks

Packages

No packages published