How to get value of var total in message,
and also i tried declare inside function but it gives undefined variable
var total = '';
$.validator.addMethod("valueNotEquals", function (value, element, arg) {
var fund_old = $("#current_fund").val();
var fund_new = $("#new_fund").val();
total = parseFloat(9999999999.999999) - parseFloat(fund_old);
if (parseFloat(fund_new) <= parseFloat(total)) {
return true;
} else {
return false;
}
return true;
}, 'sry sktiman' + total + 'is remaining value');
In result i am getting blank value of total
$("#current_fund").val()gives you any/correct value?.validate().addMethodis deeply flawed. These validators are supposed to be reusable, but yours will always do the same, comparing the values of#current_fundand#new_fund. I'd suggest to start over again, read the documentation and have a look at some of the demos.