.live() doesn't work in JQuery 1.4.4
I have a problem. In my last project I used JQuery 1.3.2, now I'm using latest version of jquery (It's 1.4.4). After I've added new elements in DOM I add listener of events on some class:
Example:
$(".pushme").live("click",function(ev){
alert(ev.target.id);
});
it works in 1.3.2, but It doesn't work in 1.4.4.
In the firebug I see something lik开发者_如何转开发e this:
q.replace is not a function
p.removeAttribute("id")}}return g(m,p,...[p]).length>0}})();(function(){var g=
Could you help me? I read documents from jquery.com, but It didn't help me.
Are you sure, this error message is generated by your live-Function? The error message says, that "replace" is not a function, but this has nothing to do with your posted code. Please check out the exact line of code where this error occurs or search the keyword "replace" in your project.
Perhaps, there is a javascript error before your code is executed and in this case, your live-function is never called.
After one day of searching I found mistake! The .live() function didn't work because I had added this code:
Object.prototype.size = function(){
var len = this.length ? --this.length : -1;
for (var k in this)
len++;
return len;
}
Thanks EvilMM for help =)
精彩评论