Click here to Skip to main content
15,889,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In Firefox, If I Tab on the controls in MVC View, then tab key is not working. it doesn't go to the next control.

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);" })


C#
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);
        }
    }



Thanks

What I have tried:

i have tried with
charCode == 9 
allowing in js code.
Posted
Updated 12-Dec-16 2:02am

1 solution

The code after
else { return true; }

is not reachable.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900