Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does bind and unbind mean in jquery?

What does bind and unbind mean in jquery in idiot slow learner terms?

like image 757
JasonDavis Avatar asked Aug 12 '09 05:08

JasonDavis


1 Answers

Binding: coupling an handler to an element(s), that will run when an event occurs on said element(s). Depending on what kind of event you want to handle you'd use different functions like click(function) (alt: bind('click', function) or focus(function) (alt: bind('focus', function).

Unbinding: de-coupling of an handler from an element(s), so that when an event occurs the handler function will no longer run. Unbinding is always the same; unbind('click', function) to unbind a certain handler, unbind('click') to unbind ALL click handlers, and unbind() to unbind ALL handlers. You can substitute click for other types of events of course.

like image 121
Darko Z Avatar answered Oct 20 '22 20:10

Darko Z