Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
436 views
in Technique[技术] by (71.8m points)

jquery 1.9.0 live function?

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

Should I use older version of jquery or another way?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...