Select typeProperty

Select 对象参考手册Select Object

Definition and Usage

The type property returns the form type of the drop-down list. For a drop-down list, the type is always "select-one" or "select-multiple".

Syntax

selectObject.type


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the type property


Example

Example

The following example returns the form type of the drop-down list:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example (example.com)</title>
<script>
function displayResult(){
  alert(document.getElementById("mySelect").type);
}
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
</form>
<button type="button" onclick="displayResult()">Show the type of the drop-down list</button>

</body>
</html>

Try it Yourself »


Select 对象参考手册Select Object Other Extensions