I've two select option, class
and class_attr
.
class
has 2 options: A and Bclass_attr
has many options: aa, bb, cc, dd, ee, ...
How do I implement if the user chooses A, the chosen max_selected
is only 5 options, and if the user changes to B, the chosen max_selected
is only 3 options.
I'm trying to do something like this:
$(".class").change(function(){
var code = $(this).val();
if(code == 1){
$(".class_attr").chosen({max_selected_options: 5});
}
else{
$(".class_attr").chosen({max_selected_options: 3});
}
$(".class_attr").trigger("liszt:updated");
});
But this seems to not work, the option list for class_attr
will be set only once (the first class max_selected_options
value selected, whether 5 or 3) and will never updated the max_selected_options
after the first time.