2

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

Community
  • 1
  • 1
Jorge
  • 17,896
  • 19
  • 80
  • 126

1 Answers1

2
$(".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

Shef
  • 44,808
  • 15
  • 79
  • 90