How do I get the selected value from a dropdown list using JavaScript?
I tried the Method blow:
<div class="form-group">
<select class="form-control" id="naan" name="naan">
<option selected="selected" disabled="disabled" value="">Choose Naan</option>
<option value="No Naan" style="font-size: 14px">No Naan</option>
<option value="Naan" style="font-size: 14px">Naan</option>
<option value="Garlic Naan" class="red">Garlic Naan +$1.00</option>
<option value="Roti" style="font-size: 14px">Roti</option>
</select>
</div>
var e = document.getElementById("naan");
var strUser = e.options[e.selectedIndex].value;
console.log('You selected: ', strUser);
It only selects the first option when I click the select box to select option. It returns "Choose Naan". If I remove first option then it returns "No Naan" instead of the value I select.