Latest web development tutorials

HTML DOM Select multiple property

Select Object Reference Select Objects

Definition and Usage

multiple property sets or returns whether there is more than one option is selected.

grammar

Setting multiple properties:

selectObject.multiple=true|false

Returns multiple properties:

selectObject.multiple


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support multiple attributes


Examples

Examples

Select multiple options in the drop-down menu:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    document.getElementById("mySelect").multiple=true;
}
</script>
</head>
<body>

<form>
<select id="mySelect" size="4">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
</form>
<button type="button" onclick="displayResult()">允许多个选择</button>
<p>按下Ctrl键来选择多个选项</p>

</body>
</html>

try it"


Select Object Reference Select Objects