I would like to use jQuery to validate numbers entered into my textboxes on my webpage. I would like to validate it to make sure that it is:
- A number
- In the range 0.100 to 10.000
- To 3 decimal places
I have the following code - but how can I expand it to suit my needs:
- $('.numbersOnly').keyup(function () {
- if (this.value != this.value.replace(/[^0-9\.]/g, '')) {
- this.value = this.value.replace(/[^0-9\.]/g, '');
- }
- });
Any help would be greatly appreciated!