jQuery Chosen plugin add options dynamically

First, you need to add the <option>s to the <select> that Chosen was bound to. For example: $(‘.blah’).append(‘<option value=”foo”>Bar</option>’); Then, you need to trigger the chosen:updated event: $(‘.blah’).trigger(“chosen:updated”); More information can be found here (although you need to scroll down to Change / Update Events). Update 7th August 2013 The event name has changed to … Read more

How do I reset a jquery-chosen select option with jQuery?

Setting the select element’s value to an empty string is the correct way to do it. However, that only updates the root select element. The custom chosen element has no idea that the root select has been updated. In order to notify chosen that the select has been modified, you have to trigger chosen:updated: $(‘#autoship_option’).val(”).trigger(‘chosen:updated’); … Read more

Clear and refresh jQuery Chosen dropdown list

Using .trigger(“chosen:updated”); you can update the options list after appending. Updating Chosen Dynamically: If you need to update the options in your select field and want Chosen to pick up the changes, you’ll need to trigger the “chosen:updated” event on the field. Chosen will re-build itself based on the updated content. Your code: $(“#refreshgallery”).click(function(){ $(‘#picturegallery’).empty(); … Read more

How can I use jQuery validation with the “chosen” plugin?

jQuery validate ignores the hidden element, and since the Chosen plugin adds visibility:hidden attribute to the select, try: $.validator.setDefaults({ ignore: “:hidden:not(select)” }) //for all select OR $.validator.setDefaults({ ignore: “:hidden:not(.chosen-select)” }) //for all select having class .chosen-select Add this line just before validate() function. It works fine for me.