jQuery addClass example

Change class name on click in jQuery

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="#" id="trigger">Go</a>

CSS

#myselect { width: 150px;}

JavaScript

$("#trigger").click(function(){
	let $mySelect = $("#myselect");

  // Make sure previous instantiations have been cleaned-up.
	$mySelect.chosen("destroy");
	$mySelect.html('<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option>');
	$mySelect.chosen({rtl: true, allow_single_deselect: true});
})