Source Code:
(back to article)
Submit
Result:
Report an issue
<div> <pre> <input type="text" id="copyInput" value="Copy this text"> <button onclick="document.getElementById('copyInput').select(); document.execCommand('copy'); alert('Text copied!');">Copy</button> <script> document.getElementById('copyInput').addEventListener('paste', function(event) { alert('Pasted content: ' + event.clipboardData.getData('text')); }); </script> </pre> </div>