jQuery Event - click() Method
Example
Hide or show the element when the button is clicked:
$("button").click(function(){ $("p").slideToggle(); });
Definition and Usage
A click event occurs when an element is clicked.
A click occurs when the mouse pointer is placed over an element, then the left mouse button is pressed and released.
The click() method triggers a click event or specifies the function to be executed when a click event occurs.
Binds the function to the click event
Syntax
$(selector).click(function)
Parameter | Description |
---|---|
function | Optional. Specifies the function to be executed when a click event occurs. |