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!

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


Build 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
Chase Lee
29,275 Points

I don't remember it exactly, but I think you have to replace:

return blanks.indexOf(true) != -1; }


return blanks;

Also here is a thread on how to display code in the forum.

Thanks but still not working

Chase Lee
Chase Lee
29,275 Points

Try taking out one of the last two semi colons.

I had just forgotten to close with a ); thanks anyway=)

Any luck???