summary:
I recently made a project, which has a requirement: to realize the function of clicking the button to copy the link, find relevant information online, and find several plug-ins. ZeroClipboard is a copy function implemented through flash. With more and more proposals to abolish flash, I wonder if it can be used to copy and cut 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() {}});