The jQuery event click() method is triggered when an element is clicked. The click() method triggers the click event or specifies a function to run when a click event occurs.
Syntax
$(selector).click()
$(selector).click(function)
| Parameter | Description |
|---|---|
function | Optional. Function to run when the event occurs |
Basic Example
In the jQuery code listed above, the click() method specifies that a function should run when the click event occurs. In the example below, the div element will be hidden once it is clicked.
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("div.#hideMe").click(function () {
$("div.#hideMe").hide();
});
});
</script>











