There can be different ways to add a handler to an event, or to set the only handler.
First, some background:
This is the simplest way, when you just set a handler:
someElement =
document.getElementById("someId");
someElement.onclick =
function(event) {}
someElement.onclick = function() {}
You can add event handler (called event listener) and have more than one handler on the same element (same event instance):
someElement.addEventListener("click", function() {});
See:
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener[
^].
Now, you might better understand what jQuery does:
https://api.jquery.com/on.
That is,
someElement.on( "click", function() {
});
In this function, the arguments
selector and
data are optional, please see the jQuery documentation page on "on" referenced above.
—SA