[jQuery1.9]Cannot read property ‘msie’ of undefined错误的解决方法

简介: 原文: [jQuery1.9]Cannot read property ‘msie’ of undefined错误的解决方法 $.browser在jQuery1.9里被删除了,所以项目的js代码里用到$.browser的地方就会报这个错。
原文: [jQuery1.9]Cannot read property ‘msie’ of undefined错误的解决方法

$.browser在jQuery1.9里被删除了,所以项目的js代码里用到$.browser的地方就会报这个错。

jQuery1.9里对不少API做了废弃或者删除。幸运的是,jQuery社区考虑到了这么做给开发人员带来的麻烦,在1.9同时也推出了一个新插件jQuery Migration,该插件可以检查出在1.9之后被废弃或者删除的API,恢复原有功能,从而保证已有的js代码能在最新的jQuery下正常运行。

下面是具体的解决方法,只需要在jQuery引用后加上一行对jQuery Migration的引用即可。

 

<script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>

 

目录
相关文章
|
2月前
|
存储 JavaScript 前端开发
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
|
2月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
40 0
|
2月前
|
JavaScript
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
35 0
|
2月前
|
前端开发 JavaScript
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
32 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
|
5月前
|
JavaScript
jQuery图片延迟加载插件jQuery.lazyload
jQuery图片延迟加载插件jQuery.lazyload
|
1天前
|
JavaScript 前端开发
jQuery Growl 插件(消息提醒)
jQuery Growl 插件(消息提醒)
9 4
jQuery Growl 插件(消息提醒)
|
3天前
|
存储 JSON JavaScript
jQuery Cookie 插件
jQuery Cookie 插件
13 4
jQuery Cookie 插件