我创建了一个Javascript命名空间以避免与其他Javascript代码冲突。JavaScript命名空间和jQuery事件处理程序
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 ...
}
};
请问我该如何引用我的封闭名称空间?
谢谢你这么创建一个封闭太多了! – Ammar