What is the reason for var $this = this

后端 未结 6 1776
一生所求
一生所求 2020-12-14 18:26

I\'m not the best at jquery and I came across a var initialization that I don\'t know why the person who wrote the code did it this way.

In the init for a plugin, we

6条回答
  •  爱一瞬间的悲伤
    2020-12-14 19:09

    It means nothing in this case (no pun intended). It would be more logical if the statement was var $this = $(this) since that would allow for all the nice jQuery functionality to be used.

提交回复
热议问题