【发布时间】:2013-11-25 20:57:19
【问题描述】:
我习惯了 Mootools,它有一个绑定方法。 据我所知,JQuery 的 bind() 用于事件。
所以,在类方法中,我习惯这样做:
$.each(items,function(index,item){
//[...] then here this refers to the class constructor, not item
}.bind(this));
如何在 JQuery 中做到这一点?
【问题讨论】:
-
你知道
bind是香草JS吗? -
是的,但它只支持 IE9+,直到 IE11,我仍然(遗憾)支持 IE8