I want to validate some input to check that it is a positive currency value of the format:
0.5, 0.55, 5 (note this one), 5.5, 5.55, 55 etc etc.
The code that I'm using is:
if ($("#gross").val()>0 && !/^\d+?\.?\d?\d$/.test($("#gross").val())) {
alert($("#gross").val() + " is invalid currency");
}
It works for everything except a single digit, eg 5 (and 5.) but does work for 5.5.
What am I doing wrong?