Home >Web Front-end >JS Tutorial >How to use jquery on()
Usage of jquery on(): The [on()] method adds one or more event handlers on the selected element and child elements. The syntax is [$(selector).on(event,childSelector, data, function)].
##Usage of jquery on():
Definition and usage
on() method adds one or more event handlers on the selected element and sub-elements.
Syntax
$(selector).on(event,childSelector,data,function)
Example
Add a click event handler to thee388a4556c0f65e1904146cc1a846bee element :
$(document).ready(function(){ $("p").on("click",function(){ alert("段落被点击了。"); }); });
Related free learning recommendations:JavaScript (video)
The above is the detailed content of How to use jquery on(). For more information, please follow other related articles on the PHP Chinese website!