jquery live() method on custom functions

Posted by user271619 on Stack Overflow See other posts from Stack Overflow or by user271619
Published on 2010-02-12T05:43:14Z Indexed on 2010/04/06 22:03 UTC
Read the original article Hit count: 213

Filed under:

I have a custom event handler, or I suppose some call it a custom jquery function.

My problem is I'm trying to apply the live() method to it. But I'm not too successful.

Here's a simple custom jquery function:

$.fn.myFunction = function() { 
    return $(this).addClass('changed'); 
}

And here I use it:

$('.changePlease').myFunction();

Ok, simple enough. But how do I apply the live() method to it??

I actually have no idea if that's even possible. But I do use live() for other things, like:

$(".changePlease").live("click",function(){ alert("hello"); });

Any thoughts on this?

© Stack Overflow or respective owner

Related posts about jquery-live