Easy Tutorial
❮ Jsref Obj Date Jsref Infinity ❯

Input Button type Attribute


Definition and Usage

The type attribute returns the type of the form element.

The type of a Button object is always "button".

Syntax


Browser Support

All major browsers support the type attribute.


Example

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

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

<form>
<input type="button" onclick="displayResult()" value="Display Button Type" id="button1">
</form>

</body>
</html>

❮ Jsref Obj Date Jsref Infinity ❯