HTML Radio Button

SQL     Data Warehousing     CSS     PHP     HTML     Database Normalization

HTML Tutorial > HTML Forms > Radio Button

A second type of input is the radio button. Radio buttons are used when you want users to be able to select one and only one of the options. Below is an example:

<input type="radio" name="color" value="red">Red<br>
<input type="radio" name="color" value="green">Green<br>
<input type="radio" name="color" value="blue">Blue<br>


In this case, the key is color, and the values can be either red, green, or blue, depending on the radio button selected.

If we want to pre-select a radio button, we'll specify "selected" at the end of the <input> tag, such as follows:

<input type="radio" name="color" value="red" selected>Red<br>

Next: Check box

Copyright © 2015   All Rights Reserved     Privacy Policy   About   Contact