How can I execute copy to clipboard with many inputs? I have this code
HTML CODE
<input type="text" value="Hello" id="myInput1"> <input type="text" value="World" id="myInput2"> <button onclick="myFunction()">Copy text</button> SCRIPT CODE
<script> function myFunction() { var copyText1 = document.getElementById("myInput1"); var copyText2 = document.getElementById("myInput1"); copyText1.select(); copyText1.setSelectionRange(0, 99999) document.execCommand("copy"); alert("Copied the text: " + copyText.value); } </script>
myInput1myInput2?