css
#code{ opacity: 0; }
html
<button οnclick="copy()">copy</button>
<input type="text" value="123456" id="code">
js
function copy() { var input = document.getElementById('code'); input.select(); document.execCommand("Copy"); }
css
#code{ opacity: 0; }
html
<button οnclick="copy()">copy</button>
<input type="text" value="123456" id="code">
js
function copy() { var input = document.getElementById('code'); input.select(); document.execCommand("Copy"); }