From http://api.jquery.com/on/ :
.on( events [, selector ] [, data ], handler(eventObject) )
I know this may seem a little silly, but can anyone explain the syntax here?
What does [] mean? I would think that this means you can add multiple options (selectors / data), but since you can also add multiple events, why eventsdon't they have square brackets?
Also here is an example of .on ():
$(document).on("click", ".item", function() {
alert("hi");
});
Where is used here data, recorded in the method syntax?
source
share