How can I access the one of the chained functions in a plugin?
this is my plugin, in which I need to return an appended element on the document.
(function($){
$.fn.extend({
selection: function(options) {
var defaults = {
element: "selection"
}
var options = $.extend(defaults, options);
var o = options;
var $this = this;
$this.function_1 = function(object)
{
alert('function 1');
}
$this.function_2 = function(object)
{
alert('function 2');
}
$(document.body).append("<div class='element'>Loading</div>");
var element = $('.element');
return element;
}
});
})(jQuery);
It should alerts 'function 2' when the button is clicked but it returns error on firefox.
Below is my jsffiddle,