Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Multiple ways to declare the target with bubbling? https://teamtreehouse.com/library/rsvp-checkbox
When Guil is creating the event listener "change" for the checkbox, it seems he declares the checkbox as the target with this line of code:
const checkbox = event.target;
I've only previously seen him declare the targets with an "if" statement, for example:
if (e.target.tagName === 'INPUT').
Can someone help me understand the first example? It starts at 5:14 in the video.
Sadly, there is not enough of a code sample supplied nor is there a direct reference or link to the video in question to be able to answer your question in an intelligent manner. Yes I can take a stab or two at this but it would be shooting in the dark for an answer that may or may not help you.