2

我的JS文件中有以下代码

$("a#confirm_roommate").live('click',function(){
    //code
});

但是在jquery-1.9.1.min.js中不起作用。它给出了 live is not function 的错误..

哪里不对了..?

4

1 回答 1

2

来自文档

As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().

它也从 1.9中删除

所以你应该使用on()

于 2013-07-29T15:33:59.193 回答