I have a field called price, now how to validate this field by java script? It will take only integer value and dot. It may take decimal point or not.
e.g 200,200.00 both are valid.
How shall I do that?
I have a field called price, now how to validate this field by java
Share
There are many ways to achieve this.
Without the use of any 3rd party libraries i would recommend using regular expressions.
A possible pattern used to validate price would be
here is a tutorial on using regular expressions to validate fields in java-script
Tutorial
Hope this helps