Based on the clipBoard. JS plug-in, js achieves cutting, copying, and pasting. jsclipboard. js
Abstract:
Recently, a project was created, with the following requirement: to implement the function of clicking the button to copy the link, find relevant information online, and find several plug-ins, zeroClipboard is a replication function implemented through flash. As more and more proposals are made to abolish flash, I want to see if I can achieve replication and cutting through js?
Address: https://github.com/baixuexiyang/clipBoard.js
Method:
Copy
var copy = new clipBoard(document.getElementById('data'), {beforeCopy: function() {},copy: function() {return document.getElementById('data').value;},afterCopy: function() {}});
Cut
var cut = new clipBoard(document.getElementById('data'), {beforeCut: function() {},Cut: function() {return document.getElementById('data').value;},afterCut: function() {}});
Paste
var paste = new clipBoard(document.getElementById('data'), {beforePaste: function() {},paste: function() {return document.getElementById('data').value;},afterPaste: function() {}});