harvesthq/chosen — Issue #461: Trying to get the value selected in a chosen control
Author: aquacdr
Created: 2012-01-21 05:30:25+00:00
State: open

I have a chosen control that is defined below.

Then I have this defined in my javascript section

$(document).ready(function() {
console.log("in on ready");
$(".chzn-select").chosen();
$(".chzn-select").chosen({no_results_text: "No results matched"});

$("#testselect").chosen().change(function() {
console.log("chosen control selected"); }

}

I'm then adding values to the chosen control from a rest call and then I populate the list. All that works perfectly. Now I'm trying to determine the text of the selected select control so that I can then perform some logic on it. When I select a value I get the console message "chosen control selected". However what I haven't figured out is say I have the chosen control that has 3 items. Shown as US, GER, GAR. When the US is shown I need that text.

Thanks