“change” event delegation


“change” event delegation

Hey, just curious about something.

How do you delegate/capture "change" event in vanilla js? Let's say I have a ul with class "filter" and I generate 100 li with checkboxes inside them. How can I listen for change event only with one event listener (not attaching a listener to all checkboxes).

I know I can add a click event on the ".filter" and then check for e.target and then see if that checkbox is checked.

But can I do the same with "change" event? Does it bubble to let's say <ul class="filter" ??

Thanks. I will appreciate any response.

Submitted February 27, 2017 at 10:11PM by dokojs
via reddit http://ift.tt/2lMvLyE