How to click the text to select cthe orresponding radio button with HTML?

Spread the love

To click the text to select cthe orresponding radio button with HTML, we put the radio button in thee label.

For instance, we write

<form>
  <p>What is my middle name?</p>
  <br />
  <label><input id="349" type="radio" value="1" name="question1" />Abe</label>
  <br />
  <label
    ><input id="350" type="radio" value="2" name="question1" />Andrew</label
  >
  <br />
  <label><input id="351" type="radio" value="3" name="question1" />Andre</label>
  <br />
  <label
    ><input id="352" type="radio" value="4" name="question1" />Anderson</label
  >
  <br />
</form>

to add radio buttons inside label elements.

Then we can click on the text to select the radio button.

Leave a Reply

Your email address will not be published. Required fields are marked *