Possible Duplicate:
jQuery get select option text
let's say that i have the value of the combo but without make a selection开发者_如何学Go
, now i want to know how can i make a selector that brings me the text of that value
the html
<select class=".ddlOperators" >
<option value="1">Value 1</option>
<option value="2">Value 2</option>
<option value="3">Value 3</option>
<option value="4">Value 4</option>
</select>
I tried like this
$(".ddlOperators option").find('1')
notes that 1 was the value of the option of the combo
$(".ddlOperators option[value='1']").text();
Also, your class for the select
element should not be preceded by a dot, it should be:
<select class="ddlOperators">
Demo
精彩评论