harvesthq / chosen

Deprecated - Chosen is a library for making long, unwieldy select boxes more friendly.
http://harvesthq.github.io/chosen/
Other
21.85k stars 4.1k forks source link

Max selection doesn't work #3152

Open unkulesagar opened 6 months ago

unkulesagar commented 6 months ago

I'm dynamically creating options for dropdown. Once all options generated I'm using $("#teamMember").trigger("chosen:updated") to build dropdown.

I have tried $("#teamMember").chosen({max_selected_options: 3}); before and after $("#teamMember").trigger("chosen:updated") but it does not restrict Max selection not it trigger $("#teammember").bind("chosen:maxselected", function (evt, params) {});

Code: uniqueGroupUsers.forEach((user) => { $('#teamMember').append($('

$("#teamMember").chosen({max_selected_options: 3}); $("#teamMember").trigger("chosen:updated");