JSFiddle - React, Tailwind, and code Playground
by techiedelight
HTML
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard-polyfill/2.8.6/clipboard-polyfill.js"></script>
</head>
<body>
<textarea id="content" rows="5" cols="30">Write something here...</textarea>
<button id="copy" title="Copy Textarea Content">Copy</button>
</body>
</html>
JavaScript
document.getElementById("copy").onclick = function() {
var text = document.getElementById("content").value;
clipboard.writeText(text);
}