copy text from textbox javascript code example
Example: copy text from header tag in javacript
function copyText() {
var text = document.getElementById("myText").innerText;
var elem = document.createElement("textarea");
document.body.appendChild(elem);
elem.value = text;
elem.select();
document.execCommand("copy");
document.body.removeChild(elem);
}