写这样一句话的作用是什么,为什么不直接用$(this),能帮我详细解答下吗?
4 回答
已采纳

Caballarii
TA贡献1123条经验 获得超629个赞
如果你详细学过this的话,你就会知道this在运行过程中可能会变,为了避免这种不可控的现象,先用变量把$(this)记下来,后面用就不会错了

LeeJim
TA贡献2条经验 获得超1个赞
$this 只是变量名而已。
$(this) 才是方法调用。
js的命名规范是只能以$或者_或者字母开头。
用$开头命名只是为了让代码阅读者 可以轻易区分jquery对象和其他普通element对象而已。
添加回答
举报
0/150
提交
取消