How to limit input control to accept only numeric or alpha numeric

Often it is a pain in the neck to validate text boxes for invalid characters. In some cases we expect only numbers, in some cases alpha numeric. It is easy to fix this issue with jquery

Add this snippet your js file or page. Make sure you referenced jquery. Now simple use the class “alphanumericOnly” for the text boxes for alpha numeric, and “numericOnly” class for text boxes which expects numeric only.

Leave a Reply

Your email address will not be published. Required fields are marked *