Is it possible to use jquery .on()
method instead of .delegate()
when there is no event to be listened to?
According to the .on()
documentation:
.on( events [, selector] [, data] , handler(eventObject) )
The events
argument is not optional.
The use of .on()
/.delegate()
is for elements that are added dynamically.
Since .on()
s purpose it to attach event-handlers to a certain element, it makes absolutely no sense to use it without an event. That's why the event parameter is required.
From the doc:
Description: Attach an event handler function for one or more events to the selected elements.