Get selected option from select dropdown in jquery

These code snippets will show you how to get either the value or text from a selected HTML select dropdown element.

Example HTML

<select id='days'>
    <option value='mon'>Monday</option>
    <option value='tue'>Tuesday</option>
    <option value='wed'>Wednesday</option>
    <option value='thu'>Thursday</option>
    <option value='fri'>Friday</option>
    <option value='sat'>Saturday</option>
    <option value='sun'>Saturday</option>
</select>

jQuery

Get the value

To get the value from the above (e.g. 'mon'), simple use the val function: 

$('#days').val();

Get the text

To get the text from your selected item:

$('#days option:selected').text();

Demo

Text:   Value:
Sign Up
comments powered by Disqus
Sign Up

Popular Tags

350x250

Need a web developer?

If you'd like to work with code synthesis on your next project get in touch via the contact page.