Difference between $(this) and this in jquery

前端 未结 7 2086
灰色年华
灰色年华 2020-11-28 07:40

What is the fundamental difference between using $(this) vs this

$(\'.viewComments\').click(function(ev){
    //returns the desired value
    alert(this.getA         


        
7条回答
  •  清歌不尽
    2020-11-28 07:42

    $(this) is a jQuery object and you can use the power and beauty of jQuery, but with 'this' keyword, one need to use native JavaScript.

提交回复
热议问题