Javascript Object Notation Pproblem
Javascript Object Notation Pproblem
我有这个小提琴 http://jsbin.com/EvIYomiF/4/,只是为了注意万一javascript在两个文件中。
好吧..正如您在演示中看到的那样,dom 范围以某种方式被覆盖,我想了解原因。我的意思是,self=这个黑客肯定是一个不好的做法,但我不明白为什么被覆盖
我找不到言语来描述这个问题,我很抱歉,但小提琴是我找到的轻松解释我的问题的唯一方法。
所有关于this
的猜想都是无关紧要的,每个人都在引导你走错路。
问题在于self
没有通过使用var
进行绝缘,因此它是全球性的。第二个self
将覆盖第一个。
简单地让它var self=this
就可以让它一切正常。您所做的是避免更改 jQuery 事件处理程序中this
上下文的常见做法
演示
相关文章:
- 什么是“;原型;通过JavaScript中的Object Literal Notation创建的对象的链接
- .notion vs.[]notation |插入到文本对象中
- 在JavaScript中,is't Object Literal Notation只是字典的另一个名称
- 对象创建中的JavaScript && notation
- Javascript Object Notation Pproblem
- jQuery .click +..+ notation
- Javascript or D3js Notation
- $ae. javascript notation
- Javascript $ notation
- What does the notation !{JSON.stringify(t("some.thing&q
- Javascript notation: () => { return 5; }
- JSON dot notation