I'd like to block all characters from being inputed except 0-9,a-z,A-Z range only alphanumeric characters. So when someone types ! for examplee nothing is written into input. How can I do that?
+1
A:
You need to write a function that listens for the onkeypress
event for the form field, then check to see if the form contains any unwanted characters, and if it does, you update the field with those characters removed.
webdestroya
2010-05-07 17:35:02
You can also return `false` from your `onkeypress="function()"` to prevent the character being written
Jeriko
2010-05-07 17:36:41