HTMLInputElement: multiple プロパティ
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.
HTMLInputElement.multiple
プロパティは、入力フィールドが複数の値を持つことができるかどうかを示します。 Firefox では、 multiple
は <input type="file">
でのみ対応しています。
値
論理値です。
例
js
// fileInput は <input type=file multiple> です
let fileInput = document.getElementById("myfileinput");
if (fileInput.multiple) {
// fileInput.files を反復処理
for (const file of fileInput.files) {
// ファイルの一つに対してアクションを実行
}
// 一つのファイルのみが有効な場合
} else {
let [file] = fileInput.files;
}
仕様書
Specification |
---|
HTML # dom-input-multiple |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
multiple |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- FileList
- Bug 523771 - <input type=file multiple> への対応