Validating checkboxes to select 1 value

3851 views javascript

I have check boxes with 3 values, only 1 value should be selected on submit else it should give an error.

    <p class='paragraph'>How many times per week would you like to attend the gym?</p>
    <input type='checkbox' name= 'attend' value='1'>1
    <input type='checkbox' name= 'attend' value='2'> 2

answered question

you can use the radio button

1 Answer


You are looking for type=radio with identical names.

posted this

Have an answer?


Please login first before posting an answer.