disable list of options chosen Jquery

0

Good morning

I have a chosen field and would like to enable / disable the list of options based on some variables, I used the following code and it does not work, to see if someone can guide me.

JS:

$(".chosen").chosen({max_selected_options: 5});
$(".chosen").bind("chosen:maxselected", function () { alert("AAA");}); 

html:

<select id="Selecion" class="chosen" multiple="multiple" onclick="$('#Seleccion').trigger('chosen:open');" data-placeholder="Lista" class="chosen-select" style=" width:200px; padding: 7px 18px 6px 9px;" tabindex="24">
    
asked by Quarkbite 20.02.2017 в 13:26
source

1 answer

0

Try adding this line right afterwards to force it to update.

$('.chosen').trigger("chosen:updated");
    
answered by 20.02.2017 в 13:35