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 Build an Interactive Website Form Validation and Manipulation Checking Values

valeriuv
valeriuv
20,999 Points

Question regarding the 3rd challenge from Form Validation and Manipulation, it says that there's a parse error.

function isValidEmail (email) { return email.indexOf('@') !== -1; }

var $required = $('.required');

var requiredValues = function () { var blanks = new Array(); $required.each(function() { blanks.push($(this).val()); }); return blanks; }

var containsBlanks = function () { var empty = new Array(); §required.each(function() { empty.push($(this).val() == ""); }); return empty.sort().pop(); }

2 Answers

Peter Szerzo
Peter Szerzo
22,661 Points

You have a §required instead of a $required. Also, I recommend using $(this).val() === "".

Also, you will find it much easier to find errors if you don't include multiple commands on a single line (break line after every ';' essentially).

valeriuv
valeriuv
20,999 Points

Thanks a lot Peter! I actually break the code into multiple lines in the editor, but failed to markup it here.