What is the difference between this and $(this) in jQuery?

后端 未结 3 1466
情深已故
情深已故 2021-01-01 05:53

What is the difference between this and $(this) in jQuery? And when should I use which?

3条回答
  •  有刺的猬
    2021-01-01 06:26

    $() is the jQuery constructor function.

    this is a reference to the DOM element of invocation.

    so basically, in $(this), you are just passing the this in $() as a parameter so that you could call jQuery methods and functions.

    duplicate: jQuery: What's the difference between '$(this)' and 'this'?

提交回复
热议问题