<html>
<body>
<h1>HTML DOM Events</h1>
<h2>The oncopy Event</h2>
<p>Use the addEventListener() method to attach a copy event to an input element.</p>
<input id="myInput" type="text" value="Try to copy me">
<p id="demo"></p>
<script>
document.getElementById("myInput").addEventListener("copy", myFunction);
function myFunction() {
document.getElementById("demo").innerHTML = "You copied text!"
}
</script>
</body>
</html>