You cau use onpaste
event in javascript will execute a function while pasting.
This event will occur before the contents of the clipboard are pasted into the document.
Actions that invoke the onpaste event:
1)Pressing CTRL + V.
2)Selecting the Paste command from the Edit menu.
3)Opening the context menu (right mouse button) and selecting the Paste command.
Example Code
<head>
<script type="text/javascript">
function OnPaste () {
alert("This is a Paste event example");
}
</script>
</head>
<body>
Select some text, copy it to the clipboard and try to paste it to the following fields:
<br /><br />
<input type="text" size="40" />
<br /><br />
<input type="text" size="40" onpaste="return OnPaste ()" />
</body>
From the above example have two text box.First text box is a normal text box.From that you can enter anything and paste anything normally.
Whereas in the second text box is an example for onpaste
event .In this textbox i enabled the onpaste event.So,whenever you paste something in this text box.It will call a onpaste() funciton.In that function i added the alert().So before pasting alert will come.