HTML DOM
The type property of the HTMLButtonElement interface is a string that indicates the behavior type of the button element.
It reflects the type attribute of the button element.
Value
A string representing the type.
Its possible values are listed in the attribute's button types section.
Example
HTML
<button id="button" type="reset">type</button>
JavaScript
const buttonElement = document.querySelector("#button");
console.log(buttonElement.type); // "reset"
Specifications
Browser compatibility
See also
- HTMLTextAreaElement.type property
- HTMLInputElement.type property
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
