jQuery Intro

jQuery Intro Quiz

jQuery Intro Exercise

jQuery Basic

jQuery Basic Quiz

jQuery Basic Exercise

jQuery Advance

jQuery Advance Quiz

jQuery Advance Exercise

jQuery Selectors

jQuery Effects

jQuery Events

jQuery Methods and Properties

jQuery Traversing

jQuery CSS and HTML Methods

on() method in jQuery

on() Method



The on() method is used to attach an event to the selected element. The on() method is useful for binding the same handler function to multiple events. You can provide multiple event names separated by spaces as the first argument. In the example below, we add two events click and dblclick on the same element by just separating it with space.




Its syntax is:- $(selector).on(event,childSelector,data,function,map)


Further Explanation:-


Parameter Description
event Required. Specifies one or more event(s) or namespaces to attach to the selected elements.
childSelector Optional. Specifies that the event handler should only be attached to the specified child elements.
data Optional. Specifies additional data to pass along to the function
function Required. Specifies the function to run when the event occurs
map Specifies an event map containing one or more events to attach to the selected elements.

Code Explanation

All Tutorials related to jQuery Advance

All Sections related to jQuery