我有一个像这样的小部件
$.widget("ui.myWidget", {
//default options
options: {
myOptions: "test"
},
_create: function () {
this.self = $(this.element[0]);
this.self.find("thead th").click(function () {
this.self._headerClick(); //how do I do this!!!
});
this.self._somethingElse();
},
_headerClick: function (){
},
_somethingElse: function (){
},
.
.
.
该行this.self._headerClick();
引发错误。这是因为在该上下文this
中是被单击的th
元素。如何获得对 _headerClick 函数的引用?