Solution:
Step 1) Add input field with default value and Button:
<input type="text" id="myInput" value="JSHUB" >
<button type="submit" onClick="copyText()" > Copy Text</button>
Step 2) Write Javascript function to copy text to the clipboard:
function copyText(){
let copyText = document.getElementById('myInput')
copyText.select();
copyText.setSelectionRange(0, 99999) // For mobile
navigator.clipboard.writeText(copyText.value)
alert("copied text": copyText.value)
0 Comments
Thank you for Comment