Using event delegation to attach events to future controls
This recipe demonstrates event delegation and event bubbling. By adding elements at runtime, we will also demonstrate how delegation helps you attach events to future controls. The constructs used in this example are as follows:
Construct |
Type |
Description |
---|---|---|
|
jQuery selector |
This selects all elements with the specified HTML tag. |
|
jQuery method |
This adds the specified CSS class to each matched element. |
|
jQuery method |
This attaches elements at the end of each matched element. |
|
jQuery selector |
This selects an element with the specified attribute equal to the |
|
jQuery event |
This is fired when you click on an element. It corresponds to the JavaScript |
|
jQuery event |
This is fired when you double-click on an element is. It corresponds to the JavaScript |
|
jQuery event binder ... |