Skip to content

Instantly share code, notes, and snippets.

@buru
Created June 7, 2013 15:09
Show Gist options
  • Save buru/5729963 to your computer and use it in GitHub Desktop.
Save buru/5729963 to your computer and use it in GitHub Desktop.
Clear initialized Ajax-Chosen select to init it in some different way (e.g., changing url or GET/POST params). It's not as easy as it sounds...
$(".chzn-select").html('<option></option>');
$(".chzn-select").trigger("liszt:updated");
$(".chzn-select").next('.chzn-container').find(".search-field > input, .chzn-search > input").unbind('keyup');
// then reinit ajax-chosen as usual
$(".chzn-select").ajaxChosen({ ... });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment