I wanted to know how to add text to the input text and then copy it to the clipboard. That added text is fixed. For example, the fixed text is abc; Now according to the following code, I enter the url and with the code(that i don't konw and my programming is zero!), the fixed text is added to before the url and then copied to the clipboard abc (a text constant) + url(is varibal) --> result = abc url ---> copied to clipboard
thanks a lot
<html>
<body>
<p>Click on the button to copy the text from the text field. Try to paste the text (e.g. ctrl+v) afterwards in a different window, to see the effect.</p>
<input type="text" value="Hello World" id="myInput">
<button onclick="myFunction()">Copy text</button>
<script>
function myFunction() {
var copyText = document.getElementById("myInput");
copyText.select();
copyText.setSelectionRange(0, 99999)
document.execCommand("copy");
alert("Copied the text: " + copyText.value);
}
</script>
</body>
</html> ```