whats wrong with this code :
function calculateAddOnPrice() {
if (totalPrice <= 47) {
var polybags= $('#polybags').is(':checked') ? "0.5" : "0";
console.log(polybags);
}
else if (totalPrice >= 48 && totalPrice < 71) {
var polybags = $('#polybags').is(':checked') ? "0.35" : "0";
console.log(polybags);
}
So i have the output logged to console.
When totalPrice is less than 47 and i click the checkbox for ON the console looks like this :
0.5
When i untick it for OFF i get this :
0
It totalPrice is > 48 and i tick the box, i get the output :
0.5
0.35
And if i untick it, i get :
0
0
I have no idea why its giving me double values, can someone help me? :)
UPDATE-----
Full jQuery : https://pastebin.com/DYV92cj3
HTML for this section :
<div class="checkbox">
<label><input type="checkbox" id="polybags">I WOULD LIKE POLY BAGGING</label>
</div>
Aucun commentaire:
Enregistrer un commentaire