jQuery bind() method

jQuery bind() method

Definition

Use the bind() method in jQuery to attach event handlers for the elements matched. On event occurrence, it allows a function to run, for example, fire an alert box on click.

Note: bind() method is now deprecated. For the same results, use the jQuery on() method.

Syntax

The following is the syntax,

The following are the parameters used by the bind() method,

  • ev: Indicate event(s).
  • data: Pass additional data to the event handled. This parameter is optional.
  • func: When event occur, this functions runs.

Example

The following is the output,

jQuery bind method

Click on the text, and the following alert box will be visible,

jQuery bind method example

jQuery Events Insight and Methods
jQuery blur() method
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create free tutorials for all.

No Comments

Post A Comment