Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Copy to clipboard as typing
document.querySelector("input").addEventListener('keyup',function(){
var pom=document.createElement("textarea");
document.body.appendChild(pom);
pom.value=this.value;
pom.select();
try {
document.execCommand('copy');
pom.parentNode.removeChild(pom);
this.focus();
}
catch (err) {
console.log(err);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment