Currently I am adding Javascript validation to a ASP.NET textbox. The requirement is the first two characters should take alphabetic (a-z) and last characters should be numeric (0-9). Maxlength is 4. This should in done in keypress event.
As I am newbie to JS, don’t have much idea on how to do this.
Here is a quick way of adding a client side JavaScript validator to a textbox.
Please note that this works on LostFocus, instead of the Keydown, but you can change it to keydown if you really think thats the way to go.
Check the Fiddle: http://jsfiddle.net/B4xwK/
Also, this requires jQuery to be loaded on the client side.