How can I get the selected element value and text in JavaScript?
This is my summary:
<select size="1" id="fTerminalType" name="fTerminalType"> <option value="AP">Airport</option> <option value="PT">Port</option> <option value="BS">Bus</option> <option value="TR">Train</option> </select>
My JavaScript looks like this:
var TerminalType = document.getElementById("fTerminalType").value;
Here I can get the combobox value. But how can I get the text of the selected value? For example, if the value was "BS" , I need the text "Bus" .
source share