Jquery

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

Event Handling in jQuery

Event Handling

 

 

jQuery provides an efficient way to add an event handler. Events occur when the user performs an action like clicking an element, moving the mouse, key pressing, key up, key down, or submitting a form. When an event occurs on a target element, a handler function is executed. The advantage of using jQuery is that the code is much shorter and easy to write as compared to JavaScript. In the example, we attach a click event handler to the p tag.

 

Syntax:-

 

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