Get value of selected option in Drop Down

/ Published in: jQuery
Save to your folder(s)

This snippet gets the value of the selected dropdown

Copy this code and paste it in your HTML
  1. jQuery.fn.selectedLabel = function()
  2. {
  3. return this.find(':selected').html();
  4. }
  7. Then you can access the text from a selected option within a select:
  8. var text = $('select#month').selectedLabel();

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.