šŸ’§EventEmitter's typesafe replacement
interface dom.HTMLButtonElement
implements HTMLElement
import { type dom } from "";
const { HTMLButtonElement } = dom;

Provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating elements.


disabled: boolean
form: HTMLFormElement | null

Retrieves a reference to the form that the object is embedded in.

formAction: string

Overrides the action attribute (where the data on a form is sent) on the parent form element.

formEnctype: string

Used to override the encoding (formEnctype attribute) specified on the form element.

formMethod: string

Overrides the submit method attribute previously specified on a form element.

formNoValidate: boolean

Overrides any validation or required attributes on a form or form elements to allow it to be submitted without validation. This can be used to create a "save draft"-type submit option.

formTarget: string

Overrides the target attribute on a form element.

labels: NodeListOf<HTMLLabelElement>
name: string

Sets or retrieves the name of the object.

type: string

Gets the classification and default behavior of the button.

validationMessage: string

Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting.

validity: ValidityState

Returns a ValidityState object that represents the validity states of an element.

value: string

Sets or retrieves the default or selected value of the control.

willValidate: boolean

Returns whether an element will successfully validate based on forms validation rules and constraints.


checkValidity(): boolean

Returns whether a form will validate when it is submitted, without having to submit it.

reportValidity(): boolean
setCustomValidity(error: string): void

Sets a custom error message that is displayed when a form is submitted.

addEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLButtonElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLButtonElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
type: string,
options?: boolean | EventListenerOptions,
): void