Detect paste in input box

Itay.B picture Itay.B · Mar 27, 2011 · Viewed 16.2k times · Source

I have a input box, and I would like to use vbscript or javascript (no jquery) to capture the paste event.

Answer

philant picture philant · Mar 27, 2011

Use the onpaste event to capture the event and do what you need in Javascript. E.g. to disable the paste in an input text field:

<input type="text" onpaste="return false;" />