Skip to content

kaleidawave/duplicatejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Duplicate.js

Duplicate is a simple Javascript script for duplicating HTML elements. Given a node with children, Duplicate will clone the first child node by a number specified.

How to use:

Simply import it into your HTML (Make sure it is deferred to make it run once the DOM is loaded)

<script defer src="https://cdn.jsdelivr.net/gh/kaleidawave/duplicatejs/duplicate.min.js"></script>

Then given a node with a child

<div data-duplicate="5">
    <p> Hello </p>
</div>

Will be transformed into:

<div data-duplicate="5">
    <p> Hello </p>
    <p> Hello </p>
    <p> Hello </p>
    <p> Hello </p>
    <p> Hello </p>
</div>

(data-duplicate refers to the final number of elements)

About

A Javascript plugin for duplicating HTML elements

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published