mercredi 22 novembre 2017

Make a 4th checkbox uncheck the previous 3 and set them to disabled while checked without javascript

I am trying to make a set of checkboxes where a user can choose 1, 2 or 3 of the first 3 choices but if they choose the 4th choice it automatically unchecks any of the first 3 and then disables them so they can not be chosen unless the 4th option is again unchecked. I am not very familiar with Javascript or JQuery so if this could be done solely with HTML that would be awesome..:

    <Form action="" method="post" required="true">
       <input type="checkbox" name="REASON" value="01"/>1<br/>
       <input type="checkbox" name="REASON" value="02"/>2<br/>
       <input type="checkbox" name="REASON" value="03"/>3<br/>
       <input type="checkbox" name="REASON" value="04"/>4<br/>
    </Form>

Radio buttons do not really work well because I need to allow the user to choose "1,2,and 3" or "1 and 2" or just "4" ect... I feel like this should be really simple to do with html but I can not find anywhere to show how to do it without javascript or Jquery.




Aucun commentaire:

Enregistrer un commentaire