JQuery interacting with select boxes

If you want to find the value for a select box with JQuery it's easy:

$("#selector").val();

What if you want to find the text of the selected element? Find the option elements inside the select, and filter for the :selected one!

$("#selector option:selected").text();
Leave A Reply
All content licensed under the Creative Commons License