← All Projects

Kloner

A tiny, dependency-free JavaScript module for cloning/repeating elements.

Categories

Languages

Tags

Command npm i kloner
Latest Version v0.1.0 Demo http://kloner.js.org/

Installation #

Manual Download #

Download dist/kloner.min.js and place the following HTML in your page’s head element:

<script type="text/javascript" src="dist/kloner.min.js"></script>

CDN (Courtesy of jsDelivr) #

Place the following HTML in your page’s head element (check to make sure the version in the URL is the version you want):

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/fivefifteen/[email protected]/dist/kloner.min.js"></script>

NPM #

npm install kloner --save
// ES6
import kloner from 'kloner'

// CommonJS
const kloner = require('kloner')

Fetcher #

fetcher install fivefifteen/kloner --save

Bower #

bower install fivefifteen/kloner --save

Usage #

kloner Function #

kloner([containerSelector], [childSelector], [options])

Initializes Kloner.

Parameters #

  • containerSelector (Optional) –

  • childSelector (Optional) –

  • options (Optional) –

Examples #

window.addEventListener('load', function () {
  kloner()
})

Options #

{
  afterAdd: null,
  afterChildUpdate: null,
  afterRemove: null,
  beforeAdd: null,
  beforeChildUpdate: null,
  beforeRemove: null,
  childSelector: '[data-kloner-template], :scope > *',
  containerSelector: '[data-kloner], .kloner',
  max: null,
  min: 0,
  parameters: null,
  start: 0,
  template: null,
  updateChildren: false
}

License #

MIT. See the license file for more info.

Get in Touch

We’d love to hear from you! Whether you have a question, want to discuss a project, or just need some advice, we are here to help. Fill out the form below, and we’ll get back to you as soon as possible. For urgent inquiries, feel free to give us a call or drop us an email directly.