Radio Button in HTML is a type of input form that allows a user to select one button from a group of button. When a user clicks on a radio button, it becomes checked, while all other button remains unchecked.
<input type> specifies the component type is radio button or not. If a programmer use type="radio" than it sets the control to a radio button.
<name> tells the group name of radio buttons. It is necessary that the name remains the same within a group so then one button is selected, all other buttons in the group remains unselected.
<value> specifies the output value of input element, which will be submitted if checked.
"label" for each radio button is written by the text next to the radio button. It is not the value attribute.
Use of a Radio Button in HTML:
The use of a radio button is to allow a user to make one selection from a given list.
Only one selection can be made at a time. Checkbox is used to make multiple selections and not Radio Button.
Important points to remember while using Radio Button:
Code for creating Radio Button in HTML:
<title>Radio button in html</title>
<input type="radio" name="Button" value="Water"> Water<br>
<input type="radio" name="Button" value="Beer"> Beer<br>
<input type="radio" name="Button" value="Wine" > Wine<br>
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial