Duplicate HTML Elements Using JavaScript – repeatjs

Category: Javascript | November 6, 2018
Author:leopf
Views Total:2,753 views
Official Page:Go to website
Last Update:November 6, 2018
License:MIT

Preview:

Duplicate HTML Elements Using JavaScript – repeatjs

Description:

repeatjs is a very small and sometimes useful JavaScript plugin to duplicate HTML elements (together with styles and attributes) a certain number of times.

How to use it:

Download and import the repeatjs plugin into the HTML document.

<script src="repeat.min.js"></script>

Add the repeat-element attribute to the element you want to duplicate and specify the number of times to copy.

<div repeat-element="3">Element To Duplicate</h1>

Use the repeat-text attribute if you only want to duplicate the text within the element.

<div repeat-element="5" repeat-text="2">Element</h1>
<div repeat-text="3">Element</h1>

You Might Be Interested In:


Leave a Reply