Reputation: 157
This is an example,
<select>
<option value=1>Cars</option>
</select>
How i can get the value of selected "1" and value in list box "Cars"?
Upvotes: -1
Views: 25481
Reputation: 8451
try out this
<select id="selectID">
<option value=1>Cars</option>
</select>
using javascript
var e = document.getElementById("selectID");
var strUser = e.options[e.selectedIndex].value;
Upvotes: 3
Reputation: 5826
jQuery("#sltbox").find("option[value=1]").attr("selected","selected")
Give id as sltbox to your select tag.
Upvotes: 2