I have a input box, and I would like to use vbscript or javascript (no jquery) to capture the paste event.
The onpaste attribute lets us prevent pasting into the form. Adding the autocomplete attribute as well as preventing drag and drop into the element. If you want to avoid the on{event} code in the HTML, you can do it the cleaner way: myElement.
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;" />
Javascript supports onpaste:
http://www.quirksmode.org/dom/events/cutcopypaste.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With