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 trialJoshua Johnson
6,364 PointsBuild an Interactive Website> Form Validation and Manipulation >Checking Values
I feel dumb. I think I've checked this code a billion times character for character. Can someone tell me what I'm doing wrong?
Here's the question:
"Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'."
Here's what I put: function requiredValues(){ var $required = $(".required"); var blanks = new Array(); $required.each(function(){ blanks.push($(this).val() == ""); }); return blanks.indexOf(true) != -1; }
I've tried putting the declaration for the variable $required before the method but it didn't work that way either. HELP!!!!
4 Answers
Chase Lee
29,275 PointsI don't remember it exactly, but I think you have to replace:
return blanks.indexOf(true) != -1; }
With:
return blanks;
Also here is a thread on how to display code in the forum.
Chase Lee
29,275 PointsTry taking out one of the last two semi colons.
Joshua Johnson
6,364 PointsI had just forgotten to close with a ); thanks anyway=)
Mamal Khan
14,206 PointsAny luck???
Joshua Johnson
6,364 PointsJoshua Johnson
6,364 PointsThanks but still not working