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
Elliott Richmond
6,259 PointsJquery code challenge checking-values
Ok I'm stumped on this one!
When I check my work if fails :(
There is something wrong with your code in your 'requiredValues' function.
function isValidEmail(email) { return email.indexOf("@") != -1; } var $required = $(".required"); function requiredValues() { var reqVals = new Array(); $required.each(function(){ reqVals.push($(this).val() == ""); }); return reqVals; }
5 Answers

Caroline Hagan
12,587 PointsElliott, can you provide a link to the Code Challenge this relates to, and where possible, post your code into something like http://codepen.io/ so we can see the bigger picture.
Many thanks :-)

Elliott Richmond
6,259 PointsOops sorry! Sure thing...
Code Challenge: http://teamtreehouse.com/library/checking-values

Andrew Chalkley
Treehouse Guest TeacherrequiredValues()
should only return the values not if they equal blank or not. So removing == ""
should do the trick.

Lela Harris
5,111 PointsI don't have =="" and my code still fails.
function isValidEmail(email) {
return email.indexOf("@") != -1;
};
var $required = $(".required");
function requiredValues(){
var reqval = new Array();
$required.each(function() {
reqval.push($(this).val());
return reqval;}
);
};

Andrew Chalkley
Treehouse Guest Teacherreturn reqval;}
is in the each loop. Put it after the );
and before };