Quote:@Html.TextBoxFor(model => model.FirstName, new { @class = "form-control", @placeholder = "First Name", @id = "txtFirstName", @maxlength = "50", onkeypress = "return onlyAlphabets(event,this);" }) @Html.TextBoxFor(model => model.LastName, new { @class = "form-control", @placeholder = "Last Name", @id = "txtLastName", @maxlength = "50", onkeypress = "return onlyAlphabets(event,this);" })
function onlyAlphabets(e, t) { try { if (window.event) { var charCode = window.event.keyCode; } else if (e) { var charCode = e.which; } else { return true; } if (charCode == 9 || (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123)) return true; else return false; } catch (err) { alert(err.Description); } }
charCode == 9
else { return true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)