How to get the select list value of a HTML list using JQuery

I have a select element in my form as follows.

<select id='hobby'>
   <option value='cy'>Cycling</option>
   <option value='mu'>Listening to Music</option>
   <option value='pt'>Painting</option>
   <option value='rn'>Running</option>

How can I get the selected value of this using JQuery?


  • DavidMDavidM USA
    edited January 2014

    Use $("#hobby option:selected").text();

    If you need to get the text value of a specific option,
    $("#hobby option[value='mu']").text()

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion