Select multiple Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Select


The multiple property sets or gets whether more than one option/item can be selected from a drop-down list.

Set the multiple property with the following Values

Value Description
true|false Sets whether more than one option in a drop-down list can be selected

Return Value

A Boolean, returns true if multiple selection in the drop-down list is enabled, otherwise it returns false

Allow multiple selection in a drop-down list:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<select id="mySelect" size="4">
</select>/*from  w  w w. ja  v a2 s  .c o  m*/

<button type="button" onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {
    document.getElementById("mySelect").multiple = true;
    document.getElementById("demo").innerHTML = "You can now select multiple options.";


Related Tutorials