HTML DOM Input Button type attribute
Definition and Usage
type property returns the type of form elements.
Button object type is always "button".
grammar
buttonObject.type
Browser Support
All major browsers support attribute type
Examples
Examples
The following example will return to the form element type button:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ 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>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ 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>
try it"
Button Objects