1. Home
  2. Computer Science MCQs
  3. Jquery
  4. Why use $('#list').on('click', 'li', handler) instead of…

Added 2 Nov 2026

Why use $('#list').on('click', 'li', handler) instead of $('li').click(handler)?

  1. It works only on the first li element
  2. It also handles li items added later Correct answer
  3. It prevents the click event from firing
  4. It runs the handler twice for safety

Correct answer

B. It also handles li items added later

16 views

MCQSEXAM

Explanation

Event delegation attaches one handler to the parent, which catches bubbling clicks from current and future child elements. It is efficient for dynamic lists.

Reference

Asked in: Frontend Developer Tests, Technical Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Jquery MCQs

Practise all Jquery MCQs

Similar MCQs