Howdy, Stranger!

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

Categories

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

NickFNickF USAMember Posts: 132

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>
</select>

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

Tagged:

Comments

  • DavidMDavidM USAMember Posts: 342
    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.