Home >Web Front-end >JS Tutorial >Detailed analysis of the usage and difference between delegate and on in jQuery_jquery
In jQuery1.7, .delegate() has been replaced by .on(). As with earlier versions, it still uses the most efficient means of event delegation.
In event binding and delegation, delegate() and on are generally equivalent.
.delegate() adds one or more event handlers to the specified element (a child element of the selected element) and specifies the function to run when these events occur.
on(events,[selector],[data],fn), the parameter [selector] is optional,
a selector string for the descendants of the selector element of the filter that triggers the event.
For example:
The delegate’s selector is required.