Javatpoint Logo
Javatpoint Logo

jQuery bind()

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.

Syntax:

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.

Test it Now

Output:

Click on the statement.

Advantages of jQuery bind() event

  • It is compatible on various browsers.
  • It is quite easy and quick to bind event handlers.
  • It provides some shorthand and easy methods with click(), hover() etc. events for binding event handlers.

jQuery bind() example with mouseenter() and mouseleave() events

Let's take an example of jQuery bind() with mouseenter() and mouseleave() events.

Test it Now





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA