I have a select div that I\'m using the chosen jquery plugin to style and add features to (most notably, search). The div looks something like this,
$('#foobar').prop('disabled', true).trigger("chosen:updated");
This works Perfect!!!! @chosen v1.3.0
$(document).ready(function () {
$("#foobar").chosen().on('chosen:showing_dropdown',function() {
$('.chosen-select').attr('disabled', true).trigger('chosen:updated');
$('.chosen-select').attr('disabled', false).trigger('chosen:updated');
$('.search-choice-close').hide();
});
$('.search-choice-close').hide();
});
In the lastest version of chosen, liszt:updated
is not working anymore. You need to use chosen:updated
:
$(".chosen-select").attr('disabled', true).trigger("chosen:updated")
Here's a JSFiddle.
PSL was correct, but chosen has been updated since.
Put this after you do the disabling:
$("#your-select").trigger("chosen:updated");
$("chosen_one").chosen({
max_selected_options: -1
});
You can try this:
$("#foobar").prop('disabled',true).trigger("chosen:updated").chosen('destroy').chosen()