Firefox sends charCode 0 when backspace is pressed

This commit is contained in:
Dan Hansen 2010-12-12 01:09:47 -05:00
parent 52a3996ad0
commit 55b16b00f4

View file

@ -11,6 +11,7 @@ var Validation = {
}, },
events: { events: {
usernameKeypress: function(evt) { usernameKeypress: function(evt) {
if(evt.charCode === 0) { return; }
if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.charCode))) { if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.charCode))) {
evt.preventDefault(); evt.preventDefault();
} }