Adding a Radio Button in Input Filed
29-01-18 Course- HTML5-Simple
A radio button is used to create a series of options of which only one can be selected. It is displayed as a circle, which when selected, displays a dot in the middle. You can create a radio button by adding the <input type=”radio” > tag to your HTML code.
Let’s do the following steps to add a radio button:
<!DOCTYPE html>
<html>
<head>
<title> Adding Radio Button input Field</title>
</head>
<body>
<h4> Choose a Marital Status</h4>
<form action=””>
<input type=”radio” name=”status” value=”single checked” />
Single
<input type=”radio” name=”status” value=”Married” />
Married
<input type=”radio” name=”status” value=”unmarried” />
Unmarried
<input type=”radio” name=”status” value=”Divorced” />
Divorced
</form>
</body>
</html>
Save the document with the name AddingRadioButton.html and open on browser.
Note: The difference between a check box and a radio button is that radio buttons work in mutually exclusive groups and only one radio button can be selected at a time.