I recently developed jquery in IE10. I would like to summarize the incompatibility between multiple choice combobox and combobox in jquery. If you are interested, I would like to know how to develop jquery in IE10 recently, the compatibility of multiple choice of combobox in jquery is summarized.
When the attribute "multiple: true" is set for combobox, IE10 cannot complete multiple selections. The error is as follows:
The Code is as follows:
Function _ 7e8 (_ 7e9, _ 7ea ){
Var _ 7eb = $. data (_ 7e9, "combobox ");
Var opts = _ 7eb. options;
Var _ 7ec = $ (_ 7e9). combo ("getValues ");
Var _ 7ed = _ 7ec. indexOf (_ 7ea + ""); // an error is returned in row 10650.
If (_ 7ed> = 0 ){
_ 7ec. splice (_ 7ed, 1 );
_ 7e7 (_ 7e9, _ 7ec );
That is to say, the indexOf method is not supported in F12. There are two solutions to this problem:
1. modify source code
Modify the above Code
The Code is as follows:
Function _ 7e8 (_ 7e9, _ 7ea ){
Var _ 7eb = $. data (_ 7e9, "combobox ");
Var opts = _ 7eb. options;
Var _ 7ec = $ (_ 7e9). combo ("getValues ");
Var _ 7ed = (function (arr, str ){
Str = str + "";
For (var I = 0, l = arr. length; I If (arr [I] = str) return I;
}
Return-1;
}) (_ 7ec, _ 7ea );
If (_ 7ed> = 0) {// modified
_ 7ec. splice (_ 7ed, 1 );
_ 7e7 (_ 7e9, _ 7ec );
}
2. Add the indexOf Method
The Code is as follows:
If (! Array. prototype. indexOf ){
Array. prototype. indexOf = function (target ){
For (var I = 0, l = this. length; I If (this [I] === target) return I;
}
Return-1;
};
}
In fact, I recommend the first method, because it is more convenient, I am using the first method.