Skip to content
Justice Tech School

Event Delegation

Attach one handler to a parent for dynamic children.

Example
$("#list").on("click", "li", function () {
  $(this).toggleClass("done");
});

Exercise

Delegate to li.

$("#l").on("click", "", fn)

Quiz Test

Why delegate?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.