Validating checkboxes to select 1 value

3851 views javascript
-4

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

<tr>
  <td>
    <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
  </td>
</tr>

answered question

you can use the radio button

1 Answer

13

You are looking for type=radio with identical names.

posted this

Have an answer?

JD

Please login first before posting an answer.

Ads

Categories