HTML form radio buttons

A radiobutton is a set of buttons with only one selectd state. When a radiobutton is selected the other ones are unselected. That's why they behave like the "radio buttons" of a car for sample. It is defined with the input tag using the attribute type and the value "radio". The name must be the same for all the bounded radio buttons. Only the selected radio button is sent to the server.

You can force a default selected button using the checked attribute.

Usual attributes

Attribute name Attribute value
class Set a value for CSS rules. The CSS rule will be applied to all tags with the same class name
checked This attribute (no value is required) will initialize the component with a checked state.
disabled It will disable for any usage the component
id Set a unique value, it is useful for JavaScript or for CSS rule. For CSS it will be applied only for this tag
name The name of the parameter sent to the server
style Set a CSS value. It has always priority for general CSS rules. Sample : "background-color:red;color:white"
value The value sent to the server when the component is checked

Example

Preview