Javascript examples for DOM HTML Element:Input Radio
The type property returns the type of form radio button.
For a radio button object, this property will always return "radio".
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:
<!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>