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
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.