Copy Text & Input Value To The Clipboard Using Pure JavaScript – Copyer.JS

Category: Javascript , Text | December 27, 2018
Author:spacetalehq
Views Total:369 views
Official Page:Go to website
Last Update:December 27, 2018
License:MIT

Preview:

Copy Text & Input Value To The Clipboard Using Pure JavaScript – Copyer.JS

Description:

Copyer.JS is a vanilla JavaScript library that has the ability to copy text within a container of an input field to the clipboard using the document.execCommand API.

How to use it:

Import the JavaScript file copyer.js into the document.

<script src="./src/copyer.js"></script>

Call the copyer() function and specify the selector which holds the text you want to copy.

<p id="demo">CSSSCRIPT.COM</p>
<input id="demo-2" type="text" placeholder="CSSSCRIPT.COM">
copyer("demo");
copyer("demo-2");

You Might Be Interested In:


Leave a Reply