What is wrong with this JavaScript code?
I have two checkboxes name check1 and check2. I wanted for either one to be disabled if the other one was checked. This is what I did:

    var male = document.getElementById("check1");
    var female = document.getElementById("check2");
    
    male.disabled = (female.checked == true) ? true : false;
    female.disabled = (male.checked == true) ? true : false;

It does not work at all. Is the syntax correct. What did I do wrong?
What is wrong with this JavaScript code?
===

I have two checkboxes name check1 and check2. I wanted for either one to be disabled if the other one was checked. This is what I did:

    var male = document.getElementById("check1");
    var female = document.getElementById("check2");
    
    male.disabled = (female.checked == true) ? true : false;
    female.disabled = (male.checked == true) ? true : false;

It does not work at all. Is the syntax correct. What did I do wrong?