Computers & ProgrammingFrontend DevelopmentjQuery

jQuery Click Event

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.


functionOptional. 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 () {

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top