163
rated 0 times
[
164]
[
1]
/ answers: 1 / hits: 24750
/ 11 Years ago, thu, february 20, 2014, 12:00:00
I have some multiselect and i use jquery select2.I want to disable one option in other multiselect when this option is selected in one multiselect.
i write this code,but it does work.
$(select.multiselect).on(change, function(e) {
if(e.added){
for(var i=0;i<this.options.length;i++){
var vals = $(this).select2(val);
for(var j=0;j<vals.length;j++){
if(this.options[i].value===vals[j]){
this.options[i].selected=true;
}
}
};
}
if(e.removed){
for(var i=0;i<this.options.length;i++){
if(this.options[i].value===e.removed.id){
this.options[i].selected=false;
}
};
}
});
how to do it?
More From » jquery