Input Radio type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Radio

Description

The type property returns the type of form radio button.

For a radio button object, this property will always return "radio".

Return Value

Type Description
String The type of form element the radio button is

The following code shows how to check which type of form element the radio button is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="radio" onclick="myFunction()" id="myRadio">

<p id="demo"></p>

<script>
function myFunction() {/*from w w w .  j  av a 2s  . co  m*/
    var x = document.getElementById("myRadio").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials