A summary of the incompatibilities in jquery with combobox
- 2020-03-30 01:05:08
- OfStack
Recently, jquery was developed in IE10. Some conclusions were made on the incompatibility of combobox in jquery.
When setting the property "multiple:true" to combobox, IE10 cannot complete multiple selection. The error report is as follows:
In other words, indexOf method is not supported in F12. Now there are two solutions to this problem:
1. Modify the source code
Change the above code to
2. Add indexOf method
In fact, I still recommend the first method, because it is more convenient, I use the first way.
When setting the property "multiple:true" to combobox, IE10 cannot complete multiple selection. The error report 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+"");//This is line 10650
if(_7ed>=0){
_7ec.splice(_7ed,1);
_7e7(_7e9,_7ec);
In other words, indexOf method is not supported in F12. Now there are two solutions to this problem:
1. Modify the source code
Change the above code to
<strong>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<l;i++){
if(arr[i] == str) return i;
}
return -1;
})(_7ec,_7ea);
if(_7ed >= 0){//Modified on June 25, 2013 at 19:04
_7ec.splice(_7ed,1);
_7e7(_7e9,_7ec);
}</strong>
2. Add indexOf method
<strong>if(!Array.prototype.indexOf){
Array.prototype.indexOf = function(target){
for(var i=0,l=this.length;i<l;i++){
if(this[i] === target) return i;
}
return -1;
};
}</strong>
In fact, I still recommend the first method, because it is more convenient, I use the first way.