Javascript jQuery插件调用内部函数
我想在内部调用removeSomething()(参见第9行): JS代码是:Javascript jQuery插件调用内部函数,javascript,jquery,jquery-plugins,anonymous-function,Javascript,Jquery,Jquery Plugins,Anonymous Function,我想在内部调用removeSomething()(参见第9行): JS代码是: (function($){ $.fn.extend({ Engine: function(options) { var defaults = { ... }; var options = $.extend(defaults, options); removeSomething()
(function($){
$.fn.extend({
Engine: function(options) {
var defaults = {
...
};
var options = $.extend(defaults, options);
removeSomething();
//-----------------------------------------------------------------------
//Public Functions ------------------------------------------------------
//-----------------------------------------------------------------------
this.removeSomething = function() {
...
};
}
});
})(jQuery);
但是,如果我调用removeSomething控制台输出的removeSomething不是一个函数,我该如何调用这个函数呢?该功能应在内部和外部可用
谢谢你的帮助 当使用
var
或其他=function(){…
语法声明函数时,需要先定义函数,然后再使用它,并以定义方式调用,在这种情况下:
this.removeSomething = function() {
...
};
//*then*
this.removeSomething();
使用
var
或其他=function(){…
语法声明函数时,需要先定义函数,然后再使用它,并以定义方式调用函数,在这种情况下:
this.removeSomething = function() {
...
};
//*then*
this.removeSomething();