HTMLButtonElement: thuộc tính type
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Thuộc tính type của giao diện HTMLButtonElement là một chuỗi cho biết kiểu hành vi của phần tử <button>.
Giá trị
Một chuỗi đại diện cho kiểu.
Các giá trị có thể được liệt kê trong phần button types của thuộc tính.
Ví dụ
>HTML
html
<button id="button" type="reset">type</button>
JavaScript
js
const buttonElement = document.querySelector("#button");
console.log(buttonElement.type); // "reset"
Đặc tả kỹ thuật
| Thông số kỹ thuật |
|---|
| HTML> # dom-button-type> |
Tương thích trình duyệt
Xem thêm
HTMLTextAreaElement.typepropertyHTMLInputElement.typeproperty