The type
property returns the type of the checkbox.
For a checkbox this property will always return "checkbox".
type |
Yes | Yes | Yes | Yes | Yes |
var v = checkboxObject.type
Type | Description |
---|---|
String | The type of the checkbox is |
The following code shows how to get checkbox's type.
<!DOCTYPE html>
<html>
<body>
<input type="checkbox" onclick="myFunction()" id="myCheck">
<p id="demo"></p>
<script>
function myFunction() {<!--from w w w . jav a 2 s .c o m-->
var x = document.getElementById("myCheck").type;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: