I have a scrollable div element with a number of checkboxes dynamically generated. I need to fire an event every time a different selection is made. i.e. a different set of checkboxes is selected.
I couldn’t find any onchange() handler for the tag. What event of the div can I use to handle this functionality?
I have a scrollable div element with a number of checkboxes dynamically generated. I
Share
A
<div />element itself does not have achangeevent; but thechangeevent for the inputs will bubble up through their ancestors; so you can still listen for the event on the<div />The more jQuery-esque way however, will be to delegate the handler to the
<div />element as follows;For more info, see the jQuery documentation for
on(). More information on event bubbling can be found heremy blog.