(function($) {
$.fn.myFoo= function (o){
this.element = $(this)
options = jQuery.extend({
name: "defaultName",
size: 5,
global: true
}, o);
_min = function (){ //am i private method?
alert('dud');
}
max = function (){ //am i public method?
alert('max');
}
return this.o(); //o= 'max'
}
})(jQuery);
问题 1 = 如果我要使用这条线,有没有办法调用上面的 max 方法/函数
$('#id').myFoo('max');
问题 2 = 我知道在 jquery 小部件上,下划线“_”会将方法标记为私有。$.fn 上的情况是否相同?
请注意,这条线return this.o();
是错误的,它只是为了展示我想要完成的事情