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

Adrian Badarau
Adrian Badarau
10,460 Points

Code Challenge Problem

Hello,

I just don't understand why this code does not work?

//code challenge 1

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

// Challenge 2 var $required = $('.required'); function requiredValues(){ var values = new Array(); $required.each(function(){ values.push($( this ).val() ); }; return values; };

When I run this code it says that the code under challenge 1 does not work, yet if I remove the code for challenge 2 the code for challenge 1 passes.

Can some one please help me

2 Answers

Jacob Miller
Jacob Miller
12,466 Points

Looks like you're missing the closing parenthesis for the .each() function.

Eddie Solar
Eddie Solar
20,455 Points

Yeah, it looks like you are not closing the each()