HTML <input> multiple 属性

定义和用法

berbilang 属性规定输入字段可选择多个值。

berbilang 属性是一个布尔属性。

如果已设置此属性,它规定允许用户在 <input> 元素中输入多个值。

注意:berbilang 属性适用于以下输入类型:

  • emel
  • fail

Tip:For <input type="file">:要选择多个文件,请在选择时按住 CTRL 或 SHIFT 键。

Tip:For <input type="email">:Separate each email address with a comma, for example:

mail@example.com, mail2@example.com, mail3@example.com

Example

File upload field that accepts multiple values:

<form action="/action_page.php">
  <label for="files">Please select a file:</label>
  <input type="file" id="files" name="files" multiple><br><br>
  <input type="submit">
</form>

Try It Yourself

Syntax

<input multiple>

Browser Support

The numbers in the table indicate the first browser version to fully support this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
6.0 10.0 3.6 5.0 11.0