JSFiddle - React, Tailwind, and code Playground
by marcin wrobel
HTML
<!DOCTYPE html>
<div id="copyResult"> clipboard event not fired yet! NOTE: please left-click directly on 'test' button </div>
<button onclick="executeCopy()">test</button>
<script>
function copyEventHandler(event) {
document.getElementById('copyResult').innerText = 'success: clipboard event fired, and handled in activeElement!';
}
function executeCopy() {
document.activeElement.addEventListener('copy', copyEventHandler, false);
document.execCommand('copy');
}
</script>