Home > Article > Web Front-end > jquery click([data],fn) usage example introduction_jquery
click([[data],fn])
Return value: jQuery
Overview
Trigger the click event of each matching element.
This function will call and execute all functions bound to the click event.
Parameters
fnFunctionV1.0
The handler function bound in the click event of each matching element.
[data],fnString,FunctionV1.4.3
data:click([Data], fn) can pass in data for function fn to process.
fn: The handler function bound in the click event of each matching element.
Example
Description:
Trigger click events for all paragraphs in the page
jQuery code:
$("p").click( );Description:
Hide all paragraphs in the page by clicking on them.
jQuery code:
$("p").click( function () { $(this).hide(); }); The above is the content in the JQuery reference manual, and I have consulted many related Reference materials, but none of them explain the [data] parameter in detail
The parameter data is passed to the event object as the event.data attribute value and the additional data object
The parameter fn is bound to each selection element The handler function in the event