Radio Button in HTML formRadio buttons are mainly used when the user has to select only one among a group of options. Radio button has two states and can toggle between them.
Note:Several radio buttons can be grouped together so that only one radio button can be selected at any given time. We can group radio buttons by giving same name to all the radiobuttons.
A single radio button can be created as :
Attributes of Radio Button Field:
Example of Radio button:
The above code places two radio buttons with a group name of "grpgender", one with a value "Male" and other one with value "Female". As the checked property is given for the first radio button it will be selected by default. This will give the output like :
Gender: Male Female
Radio button or CheckboxIn a web form if we can select one of the several options then we will go for Radio buttons. If the user can select more than one options then we will go for checkbox.
Example :How many languages you know ? ( Use checkbox here )
Your gender ( Use radio button here )
This article is written by plus2net.com team.