在 Chrome 或 Firefox 中没有问题,但在 IE9 中我收到“Microsoft JScript 运行时错误:对象不支持属性或方法‘live’”异常。有没有其他人遇到过这个?
2 回答
jQuery 1.9 removed methods previously marked as deprecated. live() is one of them.
When using jQuery 1.9 it is recommended to use jquery-migrate-1.0.0.js
along with it when upgrading.
The migrate file contains all of the deprecated methods and in addition writes deprecation notices to the console.
In your case off course you are starting a new project but it looks like you would benefit from using the migrate file too as it will let you know if you start using deprecated features.
Have a look at the release notes posted on the jQuery Blog for all the details and instructions:
jQuery 1.9 Final, jQuery 2.0 Beta, Migrate Final Released
.live()
在 jQuery 中已被弃用了一段时间,并在 1.9 中被删除。
改为使用.on()
适当的参数。弃用的替代品$('foo').live('evt', func)
是$(document).on('evt', 'foo', func)
但是,与其document
更好地使用更接近始终存在的元素的东西。