Hey, I have, what I think is an easy situation to solve. I am trying to have variables dynamically written to html depending whether a checkbox is ticked.
This is what I have right now - if someone might also know the proper way to write this it would be very much appreciated...
$(document).ready(function(){
if ($("#addon1").is(":checked")){
var a = 10;
}else{ var a = 0;
}
document.getElementById('total').innerHTML = a;
});
Than I have a div with id of 'total' - When the document loads it does print 0 but when #addon1 is checked it does not change to 10 - But when I refresh it does go to 10.
How can I have it update automatically? Thanks a lot for any help at all.