Home Other Copy text to clipboard script Developer's View
<html>
<head>
</head>
<body>
This script uses the JavaScript method
document.execCommand()
to copy the selected text to clipboard using
JavaScript only (ie: no Flash). The result works in IE9+, Firefox 41+,
Chrome 42+, and Opera 29+. Drag over any selected text to have the selection
automatically copied to the clipboard (with a tooltip to indicate success). A
callback function lets you define additional code to run after each successful
operation. Bye bye Flash!
<script src="copytextclipboard.js"></script>
<script>
copytextclipboard.init(function(thetext){
console.log('TEXT COPIED: ' + thetext)
// specify additional code to run whenever text contents copied to clipboard
})
</script>
</body>
</html>