Im trying to make this function to check an element and if its checked, or not, add or remove respective className. Also, if the element is disabled but is checked, it should un-check it and remove the className('yes')
function init() {
$(document.body).select('input').each(function(element) {
if (!element.checked) {
element.up().removeClassName('yes');
} else {
element.up().addClassName('yes');
}
if (element.checked && element.disabled) {
element.checked = false;
element.up().removeClassName('yes')
}
});
}
Right now, the last part, is not working, no effect