• Have Any Question?
  • contact@eitworld.com

HTML radiobutton controls





  • Radio buttons allow choosing only one option from several available options.
  • Names of all the radio buttons of same group must be same.
  • They are also created using HTML tag but type attribute is set to radio.

Syntax:

<input type= “radio” name= “any name” value= “any value” />

 

Here is an example of radiobutton control which will show three radiobuttons with names undergraduate,graduate and post graduate respectively:

Example

<!DOCTYPE html>
<html>
<body>
<form >
<input type= “radio” name= “qualification” value= “ugr” checked /> Undergraduate<br />
<input type= “radio” name= “qualification” value= “gr” /> Graduate<br />
<input type= “radio” name= “qualification” value= “pgr” /> Post Graduate
</form>
</body>
</html>

To see live output : Visit Try Yourself Editor

Output

Attributes

Here is the list of Attributes for creating radiobutton control:

Attribute Description
type (Required) It defines which input field to create.for radiobutton input control it will be set to radio.
name (Optional) It is important as the field will be identified in the other file or server by the value of this attribute.
value (Optional) The value that will be used if the radiobox is selected.
disabled (Optional) It specifies that the input field will be disabled. Generally, it is used alone without any value.
checked (Optional) It will specify that these will be shown checked initially. Generally, it is used alone without any value.

 



Real Time Web Analytics