jquery get selected text

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

very minimal way to get the value and text of a combo box using jquery

Copy this code and paste it in your HTML
  1. $('#select').change(function() {
  2. var text = jQuery(this).find(':selected').text(); //get the option text
  3. var value = jQuery(this).val(); //get the option value
  4. });

URL: http://www.musicsaurus.com

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.