Get selected value from HTML dropdown

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. var dropdown = document.getElementById('myDropdown');
  2. var index = dropdown.selectedIndex;
  3. var value = dropdown[index].value;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.