HTML DOM Radio type property
Definition and Usage
type property returns the radio button form element type.
For radio buttons, the attribute is always "radio".
grammar
radioObject.type
Browser Support
All major browsers support attribute type
Examples
Examples
The following example returns the radio button form element type:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "red") type.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Which color do you prefer? <br>
<Input type = "radio" name = "colors" id = "red"> red <br>
<Input type = "radio" name = "colors" id = "blue"> Blue <br>
<Input type = "radio" name = "colors" id = "green"> green
</ Form>
<Button type = "button" onclick = "displayResult ()"> Display input type </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "red") type.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
Which color do you prefer? <br>
<Input type = "radio" name = "colors" id = "red"> red <br>
<Input type = "radio" name = "colors" id = "blue"> Blue <br>
<Input type = "radio" name = "colors" id = "green"> green
</ Form>
<Button type = "button" onclick = "displayResult ()"> Display input type </ button>
</ Body>
</ Html>
try it"
Radio Objects