Okay so I'm trying to set the value of one form field based on the value of another. Here's the code I have so far, not sure why it isn't working... Gotta love Fridays! lol
var $j = jQuery.noConflict();
var $price = 100;
var $price2 = 75;
var $price3 = 50;
var $price4 = 25;
$j(function () {
$j( document ).ready(function() {
$j('.addon-custom-price').val(4);
});
$j('.qty').change(function () {
var $this = $j(this);
if ($this.val() > 100 || $this.val() <= 153) {
$j('.addon-custom-price').val((parseFloat($price4 /$this.val())));
}
else if ($this.val() > 70 || $this.val() <= 100) {
$j('.addon-custom-price').val((parseFloat($price3 /$this.val())));
}
else if ($this.val() > 40 || $this.val() <= 70) {
$j('.addon-custom-price').val((parseFloat($price2 /$this.val())));
}
else if ($this.val() > 24 || $this.val() <= 40) {
$j('.addon-custom-price').val((parseFloat($price /$this.val())));
}
else {
$j('.addon-custom-price').val((parseFloat(0);
}
});
});
Any help would be deeply appreciated :)
Aucun commentaire:
Enregistrer un commentaire