他の Javascript コードとの競合を避けるために、Javascript 名前空間を作成しました。
var ns = {
init: function() {
$('a').click(this.clickHandler);
},
clickHandler: function() {
// Some code here ..
// The keyword "this" does not reference my "ns" object anymore.
// Now, it represents the "anchor"
this.updateUI();
},
updateUI: function() {
// Some code here ...
}
};
囲んでいる名前空間を参照するにはどうすればよいですか?