How can I get the selected item's value and text in JavaScript?
This is my combobox:
<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 is like this:
var TerminalType = document.getElementById("fTerminalType").value;
Here I can get the value of the combobox. But how can I get the text of the selected value? For example if value was "BS"
, I need the text "Bus"
.