copy button JS
Mon Feb 08 2021 14:50:40 GMT+0000 (Coordinated Universal Time)
Saved by
@Mandyness
#javascript
/* return content of input field to variable text */
var text = document.getElementById("text");
/* return button to variable btn */
var btn = document.getElementById("btn");
/* call function on button click */
btn.onclick = function() {
text.select();
document.execCommand("copy");
}
content_copyCOPY
Comments