Javascript examples for DOM HTML Element:Input Checkbox
The type property returns the type of form element.
For a checkbox this property always returns "checkbox".
Type | Description |
---|---|
String | The type of form element the checkbox is |
The following code shows how to check which type of form element the checkbox is:
<!DOCTYPE html> <html> <body> <input type="checkbox" onclick="myFunction()" id="myCheck"> <p id="demo"></p> <script> function myFunction() {// ww w . j a v a 2 s . c om var x = document.getElementById("myCheck").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>