replaced charCode by keyCode. On every browser, keyCode is filled
with the Unicode Character Code when used in keypress. charCode is only supported in some browsers.
This commit is contained in:
parent
390587777f
commit
f5038cdc3c
1 changed files with 2 additions and 2 deletions
|
|
@ -11,8 +11,8 @@ var Validation = {
|
|||
},
|
||||
events: {
|
||||
usernameKeypress: function(evt) {
|
||||
if(evt.charCode === 0) { return; }
|
||||
if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.charCode))) {
|
||||
if(evt.keyCode === 0) { return; }
|
||||
if(!Validation.rules.username.characters.test(this.value + String.fromCharCode(evt.keyCode))) {
|
||||
evt.preventDefault();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue