How invoke live method with arguments
- by dorelal
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.