The names of the click event and the onclick event are very similar, which makes the editor wonder what is the difference between the two. So I searched for relevant information online, and this article talks about the difference between the two.
1, api explanation of click event (in jquery)
Trigger the click event of each matching element.
This function will call and execute all functions bound to the click event.
Bind in the click event of each matching element processing function.
##data:click([Data], fn ) can be passed in data for function fn to process.
fn: The handler function bound in the click event of each matching element.
ExampleDescription:Trigger click events for all paragraphs in the pagejQuery code:$("p").click();
$("p").click( function () { $(this).hide(); });
Mouse click A certain object |
The click event is a method in jquery, in js Use the execution result processing of defined events in
Recommended related courses:
The above is the detailed content of The difference between click event and onclick event. For more information, please follow other related articles on the PHP Chinese website!