javascript select and copy code example
Example: js select and copy on click
document.getElementById("copy-text").onclick = function() {
this.select();
document.execCommand('copy');
alert(window.getSelection().toString());
}
document.getElementById("copy-text").onclick = function() {
this.select();
document.execCommand('copy');
alert(window.getSelection().toString());
}