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

JavaScript Regular Expressions in JavaScript Validating a Form Validating a Username

Benefit of using Javascript over HTML5 form verification

Just wondering if there are any benefits to using the javascript procedures outlined in this and proceeding video's for checking the contents of a form field against a regex when the same process can be done relatively simply using the HTML5 verification steps outlined here.

2 Answers

Steven Parker
Steven Parker
229,644 Points

I'd think the main advantage to validating in JavaScript is if you want something other than the default HTML behaviors. For example, instead of just red borders, you might want explicit helper messages to appear.

Yea, after playing around with the javascript there's a lot more flexibility.

Everistus Akpabio
Everistus Akpabio
2,929 Points

html attributes can easily be deleted from the inspect and pass validation