![](https://images.gutefrage.net/media/user/NoNaMeCH/1631890601487_nmmslarge__1228_727_1509_1509_981570e222dd70562543b5bd11cb6106.jpg?v=1631890602000)
![](https://images.gutefrage.net/media/default/user/9_nmmslarge.png?v=1551279448000)
Das habe ich aus w3schools.com
<!-- The text field -->
<input type="text" value="Hello World" id="myInput">
<!-- The button used to copy the text -->
<button onclick="myFunction()">Copy text</button>
function myFunction() {
/* Get the text field */
var copyText = document.getElementById("myInput");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
/* Copy the text inside the text field */
document.execCommand("copy");
/* Alert the copied text */
alert("Copied the text: " + copyText.value);
}