get text of selected option javascript code example
Example 1: get selected text js
// Get highlighted text this way:
window.getSelection().toString()
Example 2: 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;