Validating javascript decimal numbers
- by Click Upvote
I'm using the following regexp to validate numbers in my javascript file:
var valid = (val.match(/^\d+$/));
It works fine for whole numbers like 100, 200, etc, however for things like 1.44, 4.11, etc, it returns false. How can I change it so numbers with a decimal are also accepted?