<!DOCTYPE html>
<html>
<body>

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

<input type="text" id="myInput" value="Try to paste something in here" size="40">

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

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

</body>
</html>