What is the difference between click() and on(‘click’) in jQuery?
.click(fn) attaches a click handler, and it is the same as .on('click', fn). Calling .click() without a function triggers the click. The method .on() can also handle many events at the same time (.on('mouseenter mouseleave', fn)) and delegated events (.on('click', '.item', fn)), which the shortcut cannot. Most developers use .on(). See jQuery Events.
Learn more about the similar topics:
| Tutorials |
|---|
| jQuery Events |
| jQuery Mouse, Keyboard and Form Events |
| jQuery Event Delegation |