1. 開発者向けのウェブ技術
  2. Web API
  3. HTMLInputElement
  4. multiple

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

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 ⁨2015年7月⁩.

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

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /