Javascript Form How to - Get RadioButton type property








Question

We would like to know how to get RadioButton type property.

Answer


<!-- w w w  .ja  v a  2 s.c o  m-->
<html>
<body>
    <form name="form1">
    <input type="radio" name=button1>Box 1
    <br><br>
    <input type="button" value="Get Button Type"
    onClick='console.log("The button type is: " + document.form1.button1.type)'>
    </form>
</body>
</html>

The code above is rendered as follows: