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

前端 未结 7 1583
面向向阳花
面向向阳花 2020-11-21 07:18

I am currently working through this tutorial: Getting Started with jQuery

For the two examples below:

$(\"#orderedlist\").find(\"li\").each(function          


        
7条回答
  •  遥遥无期
    2020-11-21 07:43

    $() 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.

提交回复
热议问题