I have this HTML
<select id="tempSelect" >
<option value="F">Fahrenheit</option>
<option value="C">Celsius</option>
</select>
I want to get the selected Option Value using Tag Name Not ID . I tried this using document.getElementById() it works fine but I want to do it by tag name. I searched a lot but could not found the solution so far.
Here is my Java script Code
var parent = document.getElementsByTagName('select');
var tempUnit = parent.options[parent.selectedIndex].value;