jQuery | click() with Examples
The click() is an inbuilt method in jQuery that starts the click event or attach a function to run when a click event occurs.
Parameter: It accepts an optional parameter “function” which is used to run when a click event occurs.
Return Value: It returns the selected element with specified function to perform.
In the below code, no function is passed to this method.
Both outputs get generated simultaneously-
In the below code, function is passed to this method.
Before clicking inside the block-
After clicking inside the block-
You can learn jQuery from the ground up by following this jQuery Tutorial and jQuery Examples.