< Jquery Tutorial

Jquery bind() Event

← Previous Next →

The jQuery bind() event is used to attach one or more event handlers for selected elements from a set of elements. It specifies a function to run when the event occurs.

It is generally used together with other events of jQuery.



Parameters of jQuery bind() event

Parameter  Description
Event It is a mandatory parameter. It specifies one or more events to attach to the elements. If you want to add multiple events they they must be separated by space.
Data  It is an optional parameter. It specifies additional data to pass along to the function.
Function It is a mandatory parameter. It executes the function to run when the event occurs.
Map It specifies an event map which contains one or more events or functions attached to the element.

Example of jQuery bind() event

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


<!DOCTYPE html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"> </script>
$(document).ready(function(){ $("p").bind("click", function(){ alert("This paragraph was clicked."); }); }); </script> </head> <body> <p>Click on the statement.</p> </body> </html>
← Previous Next →