.on() method Vs .Click() method

.on() method Vs .Click() method
0

#1

can anyone tell me when I should use .on() method and when should I use .click() method ??!
thanks in advance


#2

Use .on if you want to bind to events other than clicking. .click is just short for .on('click', ...), AFAIK (since binding to click events is so common)


#3

To add to what @kevcomedia said, the .on() method creates one event for all the matched elements. Instead, the .click() method creates a separate event for each matched element.

Also, with the .on() method you can create delegated events, which can be very useful if you’re dealing with dynamic content.