How to Get the Selected Value From a HTML Select Dropdown List?


Use the value property of the select element's DOM object.


<select id="foo-select">
  <option value="foo">Foo</option>
  <option value="bar">Bar</option>
  <option value="baz">Baz</option>


var value = document.querySelector("#foo-select").value; // will return the selected value

Latest Questions

javascript How to Check if a Javascript Array Includes a Given Value? javascript How to Completely Uninstall Nodejs, and Reinstall From Scratch on Mac OS X? javascript How to Map Values of a Javascript Object to a New Object Using a Function?