jQuery addClass example
Change class name on click in jQuery
by kneidels
HTML
<script src="https://harvesthq.github.io/chosen/chosen.jquery.js"></script>
<link rel="stylesheet" href="https://harvesthq.github.io/chosen/chosen.css">
<select id="myselect" multiple="multiple" size="3">
</select>
<br><br><br><a href="javascript:;" id="trigger">Go</a> <a href="javascript:;" id="trigger2">Reset</a>
CSS
#myselect { width: 150px;}
JavaScript
$("#trigger").click(function(){
$("#myselect").show().removeAttr('disabled').html('<option value="1" selected="selected">1</option><option value="2" selected="selected">2</option><option value="3" selected="selected">3</option><option value="4" selected="selected">4</option>');
$("#myselect").chosen("destroy");
// $("#myselect").chosen({rtl: true, allow_single_deselect: true});
})
$("#trigger2").click(function(){
$("#myselect").chosen("destroy");
$("#myselect").html('<option value="0">All</option>').removeAttr('multiple','multiple').attr({'disabled':'disabled','size':'1'});
})