I’d like to fire a custom event in the .text() function in jQuery. It seems like this should be possible but i’m having some trouble figuring out the closures(?). something like:
jQuery.fn.text = function(){
_text = jQuery.fn.text;
// fire a custom event/do something
jQuery.apply(_text,arguments);
}
I think you’ll get an infinite loop (recursive) with that. You need to save a reference to the original text function before overwriting it. You also need to return the result of the call to
_text.