jQuery click() Method

By: Bipin C Mathew 1 year, 5 months ago

The click() is an inbuilt method in jQuery that triggers the click event or attach a function to run when a click event occurs.


$(selector).click() -Trigger the click event for the selected elements.

$(selector).click(function) -Attach a function to the click event.


<!doctype html>
	<html lang="en">
			<meta charset="utf-8">
			<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
						alert("This paragraph was clicked.");  
			<p>Click Me.</p>  

In this example function is optional. It specifies the function to run when the click event occurs. 


Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.