vendredi 27 avril 2018

JS - Uncheck a checkbox and another checkbox will untick

I have two checkboxes in a form. onclick if a checkbox called email is unchecked how can I get the other checkbox to also uncheck (if it is checked)?

document.getElementById('email').onclick = function() {


     if (!this.checked) {
        !document.getElementById("other").checked;
    } else {
        // if not checked ...
    }
};

Am I completey barking up the wrong tree? Any help appriciated




Aucun commentaire:

Enregistrer un commentaire