Introducing the Delegated Event Observer Pattern
Now that we have learned some advanced details about how to use the Observer Pattern using jQuery, we will get introduced to a special variation of it that fits perfectly to the web platform and provides some extra benefits. The Delegated Event Observer Pattern (or simply Delegate Observer Pattern) is often used in web development and it utilizes the bubbling feature that most events that are fired on DOM elements have. For example, when we click on a page element, the click event is immediately fired on it, and right after this it also fires on all its parent elements until it reaches the root of our HTML document. Using a slightly different overloaded version of the jQuery's $.fn.on
method, we can easily create and attach observers on page elements for delegated events that are fired on specific child elements.
Note
The term "Event Delegation" describes the programming pattern where the handler of an event is not attached directly...