Javatpoint Logo

91-9990449935

 0120-4256464

jQuery click()

When you click on an element, the click event occurs and once the click event occurs it execute the click () method or attaches a function to run.

It is generally used together with other events of jQuery.

Syntax:

It is used to trigger the click event for the selected elements.

It is used to attach the function to the click event.

Let's take an example to demonstrate jQuery click() event.

Test it Now

Output:

Click on the statement.

Let's take an example to demonstrate the jquery click() event. In this example, when you click on the heading element, it will hide the current heading.

Test it Now

Output:

This heading will disappear if you click on this.

I will also disappear.

Me too.

Next TopicjQuery bind()