Here’s a Javascript function, which copies the text from a div to the own clipboard for copy & paste:
<button onclick="CopyToClipboard('text')">Copy text</button> <script> function CopyToClipboard(containerid) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(document.getElementById(containerid)); range.select().createTextRange(); document.execCommand("copy"); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(document.getElementById(containerid)); window.getSelection().addRange(range); document.execCommand("copy"); alert("text copied") }} </script> <div id="text">blaaaaa</div>