jQuery 1.9.0实时功能? [英] jquery 1.9.0 live function?

查看:115
本文介绍了jQuery 1.9.0实时功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jquery 1.9.0 中没有live()函数,但是 jquery.unobtrusive.ajax.js 已在使用此函数.

There is no live() function in jquery 1.9.0, but jquery.unobtrusive.ajax.js is already use this function.

我应该使用旧版的jquery还是其他方式?

Should I use older version of jquery or another way?

推荐答案

从1.7开始折旧,从1.9开始删除.改为使用on().

Depreciated as of 1.7 and removed as of 1.9. Use on() instead.

http://api.jquery.com/on/

$("#myButton").on("click", function(){
    alert("Clicked");
});

这里有很多很好的信息:

Lots of good info here:

http://www.elijahmanor. com/2012/02/differences-between-jquery-bind-vs-live.html

对于Unobtrusive Ajax,您将需要在v1.9之前包含一个jQuery版本,其中live()仍然存在.

As for Unobtrusive Ajax, you will need to include a version of jQuery prior to v1.9 where live() still exists.

如果您引用的是MS CDN,

If you are referencing the MS CDN,

http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.js http://ajax.aspnetcdn.com/ajax/mvc /3.0/jquery.unobtrusive-ajax.min.js

那么似乎没有这些直接引用jQuery.只需在代码中包含1.8版本即可,而不是1.9版本.

then it does not appear that these directly reference jQuery. Simply include the 1.8 version in your code instead of the 1.9 version.

这篇关于jQuery 1.9.0实时功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆