Reputation: 3733
I am writing a angularjs app and am trying to restrict an html tag to positive float numbers with up to 2 decimal places.
code I have now...
<input type='number' min='.01' ng-model='threshold' />
Upvotes: 1
Views: 1375
Reputation: 8783
You could use the pattern
attribute to set a proper regular expression. For example:
<input name="x" pattern="[0-9]+(\.[0-9][0-9]?)?" placeholder="000.00" />
See html5pattern.com.
Upvotes: 2