Easy Tutorial
❮ Met Namednodemap Getnameditem Prop Video Height ❯

Checkbox type Attribute


Definition and Usage

The type attribute returns the form type of the element.

For a checkbox object, this attribute always returns "checkbox".

Syntax


Browser Support

All major browsers support the type attribute.


Example

The following example returns the form element type of the checkbox:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function displayResult(){
    var x=document.getElementById("check1").type;
    alert(x);
}
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1">Do you like summer?
</form>
<button type="button" onclick="displayResult()">Display input type</button>

</body>
</html>

❮ Met Namednodemap Getnameditem Prop Video Height ❯