2

I have a select code with two option. Is there a way I can use jQuery to alert me the text within the option tag of the option I have selected? Currently I have option two selected so when I use the code below it comes back as "5". I need it to come back as "Option 2".

alert (jQuery('#bw_status').val());

The code below is the example code I am using.

<select id="bw_status">
<option value="7">Option 1</option>
<option value="5">Option 2</option>
</select>
user1636946
  • 137
  • 1
  • 3
  • 14

1 Answers1

2

Yes, try this:

jQuery('#bw_status option:selected').text()
antyrat
  • 27,479
  • 9
  • 75
  • 76