Why use $('#list').on('click', 'li', handler) instead of $('li').click(handler)?
Correct answer
B. It also handles li items added later
16 views
B. It also handles li items added later
16 views
Event delegation attaches one handler to the parent, which catches bubbling clicks from current and future child elements. It is efficient for dynamic lists.
Asked in: Frontend Developer Tests, Technical Interviews
Not sure why the answer is B? Ask here and get an explanation.