Bad Programmer Bad Programmer - 1 year ago 104
jQuery Question

How to get currently selected value of a multiple select with Jquery

I have a multiple select dropdown box. I need to make an ajax call every time an item is selected, but am having a problem getting the specific value from the select menu. Instead of retrieving the currently selected value, I get an array of all selected values. How can I get the current selected value with JQuery?

Answer Source

OK, just figured it out:


Previously I was using $('#id').val() and that was returning the array. $(this).val() will give you the current selected value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download