nanoclipboard is a JavaScript library for copy text to the clipboard. nanoclipboard has no dependencies.
var clipboard = new NanoClipboard("#btn");
clipboard.onSuccess = function(text) {
alert("Copied: " + text);
};
clipboard.onError = function(text) {
window.prompt("Ctrl+C: ", text);
};nanoclipboard's CDN provided by jsDelivr CDN
MIT License