Copy Text to Clipboard
From: https://www.w3schools.com/howto/howto_js_copy_clipboard.asp


step-1 step 2


In instructional or howto pages, it is sometine handy to have a button that copies the box's text directly to the clipboard so it can be pasted into bash command lines.


Step 1) Add HTML: Example <input type="text" value="Hello World" id="myInput"> <! text field> <button onclick="cpyFunc()">Copy text</button> <! button used to copy text>
Step 2) Add JavaScript: Example This func is in: /js/cpyTxt.js so add below to <head> <script type="text/javascript" src="/js/cpyTxt.js"><script>
function myFunction() { var copyText = document.getElementById("myInput"); // GET TEXT FIELD copyText.select(); // SELECT TEXT FIELD copyText.setSelectionRange(0, 99999); // FOR MOBILE DEVICES navigator.clipboard.writeText(copyText.value); // CPY TEXT FIELD TEXT // alert("Copied the text: " + copyText.value); // ALERT COPIED TEXT }

sudo apt install