WeCodeAcademy

jQuery Event Delegation

If you add new elements later, handlers attached directly to them will not exist. Delegation attaches the handler to a stable parent and lets it handle events from matching children, even ones added later.

Examplehtml
Open in editor »

Add a few items and click them: the single handler on the list works for all of them.

Quick check

Why use event delegation?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.