Difference between .on('click') vs .click()

后端 未结 12 2717
礼貌的吻别
礼貌的吻别 2020-11-21 05:22

Is there any difference between the following code?

$(\'#whatever\').on(\'click\', function() {
     /* your code here */
});

and

12条回答
  •  半阙折子戏
    2020-11-21 05:37

    No, there isn't.
    The point of on() is its other overloads, and the ability to handle events that don't have shortcut methods.

提交回复
热议问题