HTMLSelectElement: 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 chỉ đọc HTMLSelectElement.type trả về type của điều khiển biểu mẫu.

Giá trị

Một trong các giá trị sau:

  • "select-multiple" nếu có thể chọn nhiều giá trị.
  • "select-one" nếu chỉ có thể chọn một giá trị.

Ví dụ

js
switch (select.type) {
  case "select-multiple":
    // Multiple values may be selected
    break;
  case "select-one":
    // Only one value may be selected
    break;
  default:
  // Non-standard value (or this isn't a SELECT element)
}

Đặc tả kỹ thuật

Specification
HTML
# dom-select-type-dev

Tương thích trình duyệt

Xem thêm

  • Phần tử HTML <select> triển khai giao diện này.