jQuery.click() vs onClick

前端 未结 17 1779
情话喂你
情话喂你 2020-11-21 07:35

I have a huge jQuery application, and I\'m using the below two methods for click events.

First method

HTML

17条回答
  •  暖寄归人
    2020-11-21 08:15

    Go for this as it will give you both standard and performance.

     $('#myDiv').click(function(){
          //Some code
     });
    

    As the second method is simple JavaScript code and is faster than jQuery. But here performance will be approximately the same.

提交回复
热议问题