10.2- Radio Buttons:
This button is used for taking one choices from multiple fixed choices. Let us say there are three class of tickets- Economy, Executive and Special
Command: Class of Travel : <br />
Economy <input type='radio' name='class' /> <br />
Executive <input type='radio' name='class' /> <br />
Special <input type='radio' name='class' /> <br /> (Please note that for all the lines name='class' should be the same and visitor will be able to click only on one button)
Output:
Class of Travel :
Economy
Executive
Special Note : In this case the visitor is to click on the 'Radio Button'. If you want that, even on clicking on the Text, the button should get clicked, then use the additional tag 'label' and 'id'
Command: Class of Travel : <br />
<label for='economy'>Economy</label>
<input type='radio' name='class' id='economy' /><br />
<label for='executive'>Executive</label>
<input type='radio' name='class' id='executive' /><br />
<label for='special'>Special</label>
<input type='radio' name='class' id='special' /> In this case even if the mouse is on the text, input can be clicked. Output:
Class of Travel :