HTML DOM Input Radio Object

Input Radio object

The Input Radio object represents the HTML <input> element with type="radio".

Accessing Input Radio objects

You can use getElementById() to access the <input> element with type="radio":

var x = document.getElementById("myRadio");

Try it yourself

Tip:You can also search the form for elements collection to access <input type="radio">.

Creating Input Radio objects

You can use the document.createElement() method to create an <input> element with type="radio":

var x = document.createElement("INPUT");
x.setAttribute("type", "radio");

Try it yourself

Input Radio object properties

Properties Description
autofocus Sets or returns whether the radio button should automatically focus when the page is loaded.
checked Sets or returns the selected state of the radio button.
defaultChecked Returns the default value of the checked property.
defaultValue Sets or returns the default value of the radio button.
disabled Sets or returns whether the radio button is disabled.
form Returns a reference to the form that contains the radio button.
name Sets or returns the name property value of the radio button.
required Sets or returns whether the radio button must be selected before submitting the form.
type Returns the type of form element that the radio button is.
value Sets or returns the value property of the radio button.

Standard properties and events

The Input Radio object supports both standardsPropertiesandEvents.

Related pages

HTML Tutorial:HTML Form

HTML Reference Manual:HTML <input> Tag

HTML Reference Manual:HTML <input> type Attribute