How do I copy the text inside a div to the clipboard? I have a div and need to add a link which will add the text to the clipboard. Is there a solution for this?
Clipboard-polyfill library is a polyfill for the modern Promise-based asynchronous clipboard API.
install in CLI:
npm install clipboard-polyfill
import as clipboard in JS file
window.clipboard = require('clipboard-polyfill');
example
I'm using it in a bundle with require("babel-polyfill");
and tested it on chrome 67. All good for production.