To react to user behavior, we need to register our handlers using these event methods. Note that many DOM events only apply to certain element types; these subtleties are not covered here. Event methods are discussed in detail in Chapter 3, Handling Events.
Event methods
Binding
Event method |
Description |
.ready(handler) |
Binds handler to be called when the DOM and CSS are fully loaded. |
.on(type, [selector], [data], handler) |
Binds handler to be called when the given type of event is sent to the element. If selector is provided, performs event delegation. |
.on(events, [selector], [data]) |
Binds multiple handlers for events as specified in the events object parameter. |
.off(type, [selector], [handler]) |
Removes bindings on the element. |
... |