What is the on() method in jQuery?
<button id="b">Click</button>
var n = 0;
$('#b').on('click', function () { n++; });
$('#b').click().click();
console.log(n);
Console output
2
See jQuery Events.
Learn more about the similar topics:
| Tutorials |
|---|
| jQuery Events |
| jQuery Mouse, Keyboard and Form Events |
| jQuery Event Delegation |