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=""></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.