Correct regular expression and comma thing fully.
parseInt() likely wants no commas, so we use a value without it, and the regular expression now seems to properly match was PayPal will take as valid.
This commit is contained in:
parent
3438812e00
commit
b2c18cc59e
1 changed files with 4 additions and 3 deletions
|
@ -36,9 +36,10 @@ $(document).ready(function() {
|
||||||
var input=$(this);
|
var input=$(this);
|
||||||
var value = input.val();
|
var value = input.val();
|
||||||
var errorElement=$("span", input.parent());
|
var errorElement=$("span", input.parent());
|
||||||
|
var noCommaValue = value;
|
||||||
var re = /^[0-9,\.]+$/;
|
noCommaValue = value.replace(/,/g, "");
|
||||||
var isValid = (re.test(value) && parseInt(value) >= 120);
|
var re = /^((\d{1,3}(,?\d{3})*?(\.\d{0,2})?)|\d+(\.\d{0,2})?)$/;
|
||||||
|
var isValid = ( re.test(value) && parseInt(noCommaValue) >= 120);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
input.removeClass("invalid").addClass("valid");
|
input.removeClass("invalid").addClass("valid");
|
||||||
errorElement.removeClass("form-error-show").addClass("form-error");
|
errorElement.removeClass("form-error-show").addClass("form-error");
|
||||||
|
|
Loading…
Reference in a new issue