I'm testing some client-side validation on my site and I've run into a bit of a snag.
var budget = document.forms["jobSubmit"]["currency-field"].value;
var price = budget.replace("$", "");
if (Number(price) >= 9999) {
alert("Budgets have a maximum of 9999 US dollars.");
return false;
} else {
alert(price);
}
return false;
When I try to do a simple greater than condition on my price field, it doesn't return the proper result.
So in this situation, despite that I put in 11111, the greater than isn't working.
However, if I were to switch it to < 10, for example, it'll work just fine and all numbers under 10 will trigger the condition.
Why is this happening?

Number(11,111)is1111,111.00which is an invalid number. You will need to remove the commas or elseNumber("11,111.00")will returnNaN.