Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

Can someone give me a syntax of something that will help me validate if a number is in between two values?

1st condition - between 48 and 57.
2nd condition - between 65 and 90.
3rd condition - between 96 and 105.

Or a javascript that will validate if input text in textbox is Alpha-numeric only.

Note: The numbers are Character Codes used in Javascript.

Thank you so much and God bless. :)
Posted
Comments
arvind mepani 21-Nov-14 23:38pm    
Have you tried googling ? lots of solution is there.
Michelle Anne Rigor 22-Nov-14 4:23am    
Don't you think if I have found it in google I would not be posting a question here? I know how to use google. :)

Try this link for restrict special character using regex
http://jsfiddle.net/anomepani/o1fpybgd/4/[^]

or refer this below link for restrict character using keycode
http://stackoverflow.com/questions/950208/textbox-with-alphanumeric-check-in-javascript[^]
 
Share this answer
 
Check the below code which accept only alpha numeric charcater

C#
$('input').bind('keypress', function (event) {
    var regex = new RegExp("^[a-zA-Z0-9\b]+$");
    var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
    if (!regex.test(key)) {
       event.preventDefault();
       return false;
    }
});



Fiddle link as:

http://jsfiddle.net/M3bvN/[^]
 
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