Add to Favorites

jquery - getting those pesky dropdown values

If you have coded javascript before, you will know that getting a selected option value from a dropdown is a couple tedious extra steps more than getting a value from a text field.

With jquery, no more will you need to treat these two fields differently.

If you need the value of a dropdown that has an id of "the_dropdown" you can write a quick jquery call to get it very easily: $('#the_dropdown').val()

That's it! It is just that simple.

Comments

Be the first to leave a comment on this post.

Leave a comment

To leave a comment, please log in / sign up