DOM Interfaces

HTMLButtonElement

Build a form with the HTML form generator

Represents a button with activation behavior, form association and submission overrides. Explicitly set type="button" for non-submit actions in forms. Setting disabled prevents normal activation. Example result: button.

Formal Syntax & Structure

html syntaxhtml
const element = document.getElementById('demo'); // HTMLButtonElement

Return Value

HTMLButtonElement

An existing HTML DOM object associated with the button element in this example; this interface is a type, not a function return contract.

Working Example

Example Snippethtml
<button id="demo" type="button" value="save">Save</button><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.type);</script>
HTML Reference