How invoke live method with arguments
Posted
by dorelal
on Stack Overflow
See other posts from Stack Overflow
or by dorelal
Published on 2010-02-18T19:01:04Z
Indexed on
2010/04/10
5:23 UTC
Read the original article
Hit count: 357
jQuery
|JavaScript
I am learning how to write jQuery plugin. So why I am doing what I am doing does not matter.
I writing a plugin called live2 which does nothing else but internally calls live method.
(function($) {
$.fn.live2 = function() {
/* if there are no elements then just return */
if (!this.length) return this;
return this.each(function() {
var $this = $(this);
jQuery.fn.live.apply(this, arguments);
}); // end of return this.each(function())
}; // end of plugin
})(jQuery);
Above code should be invoked just live any live method. Instead of live use live2.
$('#container').live2('click',function(){
return false;
})
But the plugin is not working. Any idea what the fix should be.
© Stack Overflow or respective owner