For example, I have the function isPercentage, that uses a value defined in whatever function in which isPercentage is called:
isPercentage=function(){
if (value<1){
value=value*100;
console.log(value);
$(this).val(value);
}else if(value>100){
value=value/100;
$(this).val(value);
}
}
$("#userDiscount").change(function(){
var value=$(this).val();
isPercentage();
});
However, when a change occurs on $("#userDiscount"), I get a "value is not defined" error. How do I define "value" in such a way that isPercentage() can then pick it up.
Thanks!