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! While you're at it, check out some resources Treehouse students have shared here.
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 trialEric Garcia
6,217 PointsMultiple 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.
1 Answer
Daniel Landon Jr
14,733 PointsSadly, 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.
Sorry
Eric Garcia
6,217 PointsEric Garcia
6,217 PointsThe video is below, it starts at the 5:40 mark.
https://teamtreehouse.com/library/rsvp-checkbox