Radio button in HTML

Radio button in HTML
 
Radio button in HTML
  • Currently 0 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 0/5 (0 votes cast)

Thank you for rating!

You have already rated this page, you can only rate it once!

Your rating has been changed, thanks for rating!

Log in or create a user account to rate this page.


Radio buttons are used if it is necessary to choose a single item from the list. If you want to choose several items, it's better to use checkbox element.

Radio buttons are created as follows.

<input type="radio" parameters>

Field parameters are listed in the table.

Parameter

Description

name

Name of the field. Designed for the form handler to identify the field.

value

The field value defines what will be sent to the server.

checked

Sets the item which is selected by default.

Field name (parameter name) for all the group elements must have the same value. This way the browser will correctly mark the selected items (example 1).

Example 1. Using radio buttons.

<form action="/cgi-bin/handler.cgi">
  <b>What do you think the abbreviation "OS" stands for?</b><br>
  <input type="radio" name="answer" value="a1">Officer Standpoint<br>
  <input type="radio" name="answer" value="a2">Operating System<br>
  <input type="radio" name="answer" value="a3">Obese Singularity
</form>

The result is shown below.

What do you think the abbreviation "OS" stands for?
Officer Standpoint
Operating System
Obese Singularity

 

Read also

Adding a form to a page in HTML

Adding a form to a page in HTML

Text field in HTML

Text field in HTML

Buttons in HTML

Buttons in HTML

Form elements in HTML

Form elements in HTML

Post comment

basicuse.net
html5_css
106160485398655174790

Quick navigation

General navigation