Function: When clicking on a button he copy a input text , I just want that code , Thanks
edited 1×, last 09.06.16 05:33:02 am
<textarea id = "input">Some text to copy.</textarea> <button id = "copy-button">Copy</button> <script type = "text/javascript"> var input = document.getElementById("input"); var button = document.getElementById("copy-button"); button.addEventListener("click", function (event) { event.preventDefault(); input.select(); document.execCommand("copy"); }); </script>