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. }
  5.  
  6.  
  7. Then you can access the text from a selected option within a select:
  8. var text = $('select#month').selectedLabel();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.