Javascript Reference - HTML DOM Input Radio type Property








The type property returns the type of a radio button.

Browser Support

type Yes Yes Yes Yes Yes

Syntax

var v = radioObject.type 

Return Value

Type Description
String The type of the radio button




Example

The following code shows how to get the type of the radio button.


<!DOCTYPE html>
<html>
<body>
<input type="radio" onclick="myFunction()" id="myRadio">
<!--from w ww .  j  a v a  2s.  c  om-->
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myRadio").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: