Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to restrict user to enter first 4 are alphabtes and remaining are numerics in javascript onkeypress event
Posted
Comments
Sinisa Hajnal 26-Sep-14 1:58am    
Why not simply validate final entry after the user enters whole field? This way, you would need to hold an array of typed in characters (or check on each character from the start)and check on each press...

1 solution

Hi Vijay,

You can do this with javascript or jquery also. Count the length of textbox text and if it is less than 4 then check its keycode. Then only allow if it is alphabates.

Check the following fiddle :

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