mercredi 24 août 2022

How to make required atleast one checkbox when one of the main check box is checked

I want to require at least one checkbox from all when one of the upper checkboxes is enter image description hereclicked. the snap is attached herewith.

here is the javascript code

function toggleOtherTextboxVisiblewh()
{
    var check = document.getElementById('wh');
    var chk2=document.getElementsByName('s1[]');
   var chk3=document.getElementsByName('q1[]');
    if (check.checked) {
        document.getElementById('sizewh').style.display = 'block';
        
    }
    else {
           document.getElementById('sizewh').style.display = 'none';
      
           for (i=0;i<chk2.length;i++)
                chk2[i].checked=false;
                
           for (b=0;b<chk3.length;b++)
                chk3[b].value = "";
    }            
            


}



Aucun commentaire:

Enregistrer un commentaire