Template:Demo copy tool
Kaonekelo
<button onclick="copyText('sourceBox1')" style="margin-bottom:5px; padding:5px 10px;">Copy Source</button>
<textarea id="sourceBox1" style="width:100%; height:180px; font-family:monospace;">
Example Name | |
|---|---|
| Kubabika | YYYY-MM-DD |
Example Name is a fictional person used as a template example.
</textarea>
<script> function copyText(elementId) {
var copyText = document.getElementById(elementId); copyText.select(); copyText.setSelectionRange(0, 99999); // mobile devices
navigator.clipboard.writeText(copyText.value).then(function() {
var status = document.getElementById('status1');
status.textContent = "Copied!";
setTimeout(function() { status.textContent = ""; }, 2000);
}, function(err) {
alert("Failed to copy text: " + err);
});
} </script>