HTMLInputElement: multiple property

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는 <input type="file">에 대해서만 multiple을 지원합니다.

불리언 값입니다.

예제

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 GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
multiple

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기