<!DOCTYPE html>
<html>
<body>

<p>This example uses the HTML DOM to assign an "onpaste" event to an input element.</p>

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

<script>
document.getElementById("myInput").onpaste = function() {myFunction()};

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

</body>
</html>