mardi 28 mars 2023

how to reset a checkbox behavior using javascript?

I have this function checkRule, when the value2 == "Exclusive", I call checkRule to allow select only specific Checkbox, when value2 != "Exclusive" i want to reset the checkbox behavior, to be alowed to select any of the boxes. How can I do that?

   if (value2 == "Exclusive") {
        if (RPDirect.checked == true) {
            for (var i = 0; i < Checkboxes.length; i++) {
                Checkboxes[i].addEventListener("change", checkRule);
               } 
        } if (value2 != "Exclusive") {
            
        }
    }
    function checkRule(e)  {
        if (Checkboxes[7].checked == false ) {
            alert("Public must be selected.")  
        } 
        }



Aucun commentaire:

Enregistrer un commentaire