How do I copy a variable into the clipboard?
It always return:
Uncaught TypeError: copyText.select is not a function
Code
function copy() {
var allDesCode2 = document.getElementsByClassName("desCode2");
var copyText = "ABC";
for(var i=0; i<allDesCode2.length; i++) {
copyText += allDesCode2[i].innerHTML;
}
copyText.select();
document.execCommand("copy");
}