Simplest Copy To Clipboard Library

Category: Javascript , Recommended , Text | September 27, 2018
Author:sindresorhus
Views Total:581 views
Official Page:Go to website
Last Update:September 27, 2018
License:MIT

Preview:

Simplest Copy To Clipboard Library

Description:

This is a super tiny (~0.2kb) JavaScript library that allows to copy text to the clipboard for modern web.

How to use it:

Install it via NPM.

$ npm install copy-text-to-clipboard

Import the library into your project and copy specific text to your clipboard.

const copy = require('copy-text-to-clipboard');
button.addEventListener('click', () => {
  copy('Text To Copy');
});

Changelog:

v1.0.4 (09/27/2018)

  • `getSelection` => `document.getSelection()`

You Might Be Interested In:


Leave a Reply