I have this jquery code
var theTotal = jQuery('.woocommerce-Price-amount.amount').text();
var price = theTotal.replace("$", "");
jQuery('input[name="dimming"]').bind('click', function (e) {
var haller = jQuery(this).val();
if (haller == '1-10V dimmer') {
price = Number(price) + 150;
} else {
price = Number(price) - 150;
}
jQuery('.woocommerce-Price-amount.amount').text(price);
});
I have this radio button, so when I select radio button "layer2" it should add 150 to the original amount
[] layer1 (+ $0)
[] layer2 (+ $150)
Result
<span class="woocommerce-Price-amount amount">746</span>
but when I click on layer2 multiple times it always adds up, it should always be original price + 150 no matter how many times I select that button, any help please
HERE IS MY FIDDLE https://jsfiddle.net/kxvc6t2L/