Full version: jsB@nk » Utility » Don't accept special characters
URL: https://www.javascriptbank.com/dont-accept-special-characters.html
This JavaScript will not accept special characters which you type.
Full version: jsB@nk » Utility » Don't accept special characters
URL: https://www.javascriptbank.com/dont-accept-special-characters.html
<form onSubmit="return false;">This field will not accept special characters: (like !@#$%^&* etc)<br><textarea rows=2 cols=20 name=comments onKeypress="if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)) event.returnValue = false;"></textarea><br><br>This field will not accept double or single quotes:<br><input type=text name=txtEmail onKeypress="if (event.keyCode==34 || event.keyCode==39) event.returnValue = false;" size="20"><br><br>This field will only accept numbers:<br><input type=text name=txtPostalCode onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" size="20"></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->