diedVIPs

html knowhow

Text mit Button kopieren










Text mit Button kopieren

So sieht´s aus




Quellcode
<html>
<head>

<style type="text/css">Hier nichts</style>
</head>

<body style="margin: 0px 0 0 0; ">
<textarea id="input">Diesen Text in die Zwischenablage kopieren.</textarea><br/>
<button id="copy-button">Kopieren</button>

<script>
var input = document.getElementById("input");
var button = document.getElementById("copy-button");
button.addEventListener("click", function (event) {
event.preventDefault();
input.select();
document.execCommand("copy");
});
</script>
</body>

</html>









Kontakt    Datenschutz    Impressum