Computers & ProgrammingFrontend DevelopmentjQuery

jQuery Bind Event

The jQuery event bind() method attaches one or more event handlers for selected elements, and specifies a function to run when the events occur. As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document. For earlier versions, the .bind() method is used for attaching an event handler directly to elements.


eventOne or more events to attach. Multiple values are separated by space.
dataOptional data to pass along to the function
functionFunction to run when the event(s) occur


$("#close").bind("click",function () {

In the jQuery code listed above, the bind() method attaches the click event and specifies the slideUp method to run on the element with an id of #div1.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top