I need to set several if statements using jquery:
if amt (variable) is between 0 to 5000 change input value
else if amt is between 5001 to 17999 change input value
else change input value
My else if doesn't seem to work and I always end-up with the else return.
*my input type is set to number.
$('#pledge').submit(function(){
var amt = $("#donation").val();
if ((amt <= '17999' && amt >= '5001')) {
$('#priority').val('2');
}
else if (amt <= '0' && amt >= '5000') {
$('#priority').val('2');
}
else {$('#priority').val('3');}
});
It always returns priority = 3.
Aucun commentaire:
Enregistrer un commentaire