-1
$('.myclass').click(function({
that = $(this);
standardDelay = setInterval(function() {
doSomething(that.attr("id"));
}, 1000);
});
是否可以在其他js文件中访问全局变量that
?如果是的话我怎么能通过$(this)到我的setInterval函数?js混淆的全局变量
你的代码将做到这一点了。 – Quentin 2015-02-11 09:39:05
'that'应该已经可以在setInterval中访问。 – Farhan 2015-02-11 09:39:38
使用var that = $(this)在click函数中初始化它;所以它不能在外部点击功能 – V31 2015-02-11 09:39:55