Umesh M Gowda
Umesh M Gowda

Reputation: 121

Javascript validation works in Google Chrome but not in Firefox

Here is the js code

function isCharKey(evt){

 var charCode = event.keyCode
   if ((charCode > 64  && charCode <91 )|| (charCode >96 && charCode<123) || (charCode==32))
    return true;
    return false;
}

Here is the html code

<label id="exe_form_name">Name:</label><input type="text" name="tbcust_name"  id="name1" onkeypress="return isCharKey(event);">

Upvotes: 0

Views: 144

Answers (2)

Vishnu Kant Maurya
Vishnu Kant Maurya

Reputation: 15

function isCharKey(evt) {

var charCode = evt.keyCode if ((charCode > 64 && charCode <91 )|| (charCode >96 && charCode<123) || (charCode==32)) return true; return false; }

Upvotes: 0

Paul
Paul

Reputation: 1208

Change

var charCode = event.keyCode

to

var charCode = evt.keyCode

Upvotes: 1

Related Questions