I have couple of text boxes. In those text boxes I need to check few types.
- Allow only Numbers and Decimals
Example: 123.2323 //not allowed any characters
- Allow only 2 numbers after decimal
Example: 123.23 //not allowed any characters and only allowed 2 digits after decimal
- Allow only 1 number after decimal
Example: 123.2 //not allowed any characters and only allowed 1 digits after decimal
I have to check these validation in OnKeyPress event in text boxes.
If possible need all three methods.
Please help me on this.
Regular expressions and Quirksmode.org are your friends here.
Also, something like jQuery might help with validation.