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 trialnotarobot
Full Stack JavaScript Techdegree Student 4,160 PointsDemo Video Doesn't Match The Directions
This practice is confusing because in the demo video, form elements are being validated while they're being typed in, showing the validation icon, requiring a 'blur' event on each input separately. However, the directions are requiring a 'submit' event.
When using the submit event it's default is to clear out the form and refresh, so there's no way to see if it's valid with the green checkbox as shown in the video.
To see the validation symbols, add e.preventDefault() as the first line in the addEventListener(). This will prevent it from submitting the form if correct but it will show you the validation icons.
To add to the confusion, in the second video solution the e.preventDefault() is only added to the else portion of the if clause, only stopping if there's an error. This only shows the valid icon if one of the other inputs are invalid.