javascripthtmlonpaste

onPaste not recognized as event by HTML5


I'm in the middle of making a user registration form and want to prevent pasting into certain input boxes. Problem is, onPaste isn't being recognized as an event. As you can see in this image, onKeyPress is being recognized, whereas onPaste is not. https://i.sstatic.net/1FD5l.png

After some Googling it seems I am the only person on the planet who has encountered this (which probably means it's something silly and I'm a massive idiot). I'm using NetBeans IDE 8.2. Thanks in advance for any help.


Solution

  • Oops! As I suspected, I was being a massive idiot. onPaste doesn't appear to be recognized as an event in my IDE, but on run-time it will actually fire. My JavaScript code for the event was flawed and this is why nothing was happening.

    Thanks for the help all.