Pb with Chosen plugin
Pb with Chosen plugin
Hi all,
I'd like to change options of a list dynamicaly with Ajax.
Here's my code (simplified for more convenience) :
//Ajax request here ....
- $('#my_select').empty();
- $('#my_select').append(new_options_in_html);
So far so good, the previous options are deleted and the new ones are inserted
in the #my_select list (I've checked with Firebug).
The problem is that the new options won't display in the list.
Seemingly the Chosen plugin generates this code for the display:
- <div id="my_select_chzn" class="chzn-container chzn-container-single chzn-container-single-nosearch" style="width: 27px;" title="">
- <a class="chzn-single chzn-default" tabindex="-1">
- <span>Select an option</span>
- <div>
- <b></b>
- </div>
- </a>
- <div class="chzn-drop">
- <div class="chzn-search">
- <input type="text" autocomplete="off" readonly="">
- </div>
- <ul class="chzn-results"></ul>
- </div>
- </div>
The "fake" options should be displayed in ul chzn-results, but
in my case nothing happens.
- $('#my_select').trigger('chosen:updated');
Doesn't work.
- $('#my_select').toggle('chosen:updated');
The list appears as rough html and disappears whenever options change.
So can someone helps me Please ?
Thanks for advance.