get the text of the option from the value of the combobox

Possible Duplicate:
jQuery get select option text

let's say that i have the value of the combo but without make a selection , 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

链接地址: http://www.djcxy.com/p/83062.html

上一篇: 你如何在jQuery的SELECT元素中选择一个特定的选项?

下一篇: 从组合框的值中获取选项的文本