Monday, May 20, 2013

Allow only alpha numeric characters in textbox using javascript


Allowing only alpha numeric characters(A-Z,a-z,0-9) in textbox using javascript:

Below is the javascript function which will allow only alpha numeric characters in a textbox

 function checkAlphaNumeric(e) {
            
            if ((e.keyCode >= 48 && e.keyCode <= 57) ||
               (e.keyCode >= 65 && e.keyCode <= 90) ||
               (e.keyCode >= 97 && e.keyCode <= 122))
                return true;

            return false;
        }






No comments:

Post a Comment