2441

How do I get the selected value from a dropdown list using JavaScript?

<form>
  <select id="ddlViewBy">
    <option value="1">test1</option>
    <option value="2" selected="selected">test2</option>
    <option value="3">test3</option>
  </select>
</form>

0

31 Answers 31

1
2
0

Just do: document.getElementById('idselect').options.selectedIndex

Then you’ll get the select index value, starting at 0.

Sign up to request clarification or add additional context in comments.

Comments

1
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.