javascript how to find the index of selected element on a dropdown code example
Example 1: javascript get selected option
var e = document.getElementById("selectElementID");
var value=e.selectElement.options[e.selectedIndex].value;// get selected option value
var text=e.options[e.selectedIndex].text;//get the selected option text
Example 2: get index of selected option javascript
$("#sel").attr("selectedIndex")
// or
$("#sel")[0].selectedIndex
//or
$(this).prop('selectedIndex')