Answers for "html select with dropdown"

1

get selected text of html dropdown in javascript

var e = document.getElementById("selectElementID");
var value=e.options[e.selectedIndex].value;// get selected option value
var text=e.options[e.selectedIndex].text;
Posted by: Guest on March-17-2020
21

html select list

<label for="cars">Choose a car:</label>

<select id="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="mercedes">Mercedes</option>
  <option value="audi">Audi</option>
</select>
Posted by: Guest on April-13-2020

Browse Popular Code Answers by Language