Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>This example uses the addEventListener() method to attach a "copy" event to an input element.</p>

<input type="text" id="myInput" value="Try to copy this text">

<script>
document.getElementById("myInput").addEventListener("copy", myFunction);

function myFunction() {
    alert("You copied text!");
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy