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 trial
Joshua Eisikovits
3,962 Pointswhat about required?
why bother with these additional functions when a simple required in the HTML form elements such as; <input id="username" name="username" type="text" required> <input id="confirm_password" name="confirm_password" type="password" required>
would prevent the form from submitting if the fields are empty etc?
1 Answer
Steven Parker
243,656 PointsYou didn't link to a particular course or video, but I would guess that the exercise is more about understanding the capabilities of JavaScript than simply implementing a required field validation.
You never know, maybe sometime you might want some behavior other than or in addition to simply not submitting when a required item is missing.