HTMLButtonElement: type property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{ApiRef("HTML DOM")}}
The **type** property of the {{domxref("HTMLButtonElement")}} interface is a string that indicates the behavior type of the {{HTMLElement("button")}} element.
It reflects the [type](/en-US/docs/Web/HTML/Reference/Elements/button#type) attribute of the {{HTMLElement("button")}} element.
Value
A string representing the type.
Its possible values are listed in the attribute's button types section.
Example
HTML
html
<button id="button" type="reset">type</button>JavaScript
js
const buttonElement = document.querySelector("#button");
console.log(buttonElement.type); // "reset"Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- {{domxref("HTMLTextAreaElement.type")}} property
- {{domxref("HTMLInputElement.type")}} property