Latest web development tutorials

HTML DOM Input Button type attribute

Button Object Reference Button Objects

Definition and Usage

type property returns the type of form elements.

Button object type is always "button".

grammar

buttonObject.type


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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>

try it"


Button Object Reference Button Objects