Javascript DOM HTML Select multiple Property get

Introduction

Find out if more than one option in a drop-down list can be selected:

var x = document.getElementById("mySelect").multiple;

Click the button to find out if more than one option in the dropdown list can be selected.

View in separate window

<!DOCTYPE html>
<html>
<body>

<select id="mySelect">
  <option>CSS</option>
  <option>Java</option>
  <option>HTML</option>
</select>//from  w w  w . java 2s  .  c  o  m
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  var x = document.getElementById("mySelect").multiple;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related