I have a checkbox in a form and I\'d like it to work according to following scenario:
totalCost)
Reference the checkbox by it's id and not with the # Assign the function to the onclick attribute rather than using the change attribute
var checkbox = $("save_" + fieldName);
checkbox.onclick = function(event) {
var checkbox = event.target;
if (checkbox.checked) {
//Checkbox has been checked
} else {
//Checkbox has been unchecked
}
};