How do i trigger an event when an input of type="checkbox" is checked? For buttons i simply create an addEventListener with the event 'click'. Is there a similar way of doing this with checkboxes?
For example i have two containers, both containing a checkbox and a div element. When one of the checkboxes is "checked", then i want their div element (box) to change color or something like that. And then go back to its first state when its unchecked.
<div class="boxCont">
<input type="checkbox" class="checkbox">
<div class="box"></div>
</div>
<div class="boxCont">
<input type="checkbox" class="checkbox">
<div class="box"></div>
</div>
Example: https://jsfiddle.net/qua1ity/vs64yyrv/1/
Is this possible with JavaScript, without changing the HTML?