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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Elliott Richmond](https://secure.gravatar.com/avatar/f372f3c8b2b99804358cad4c0fa2a91a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
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](https://uploads.teamtreehouse.com/production/profile-photos/4412/micro_caroline-square.jpg)
Caroline Hagan
12,612 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](https://secure.gravatar.com/avatar/f372f3c8b2b99804358cad4c0fa2a91a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Elliott Richmond
6,259 PointsOops sorry! Sure thing...
Code Challenge: http://teamtreehouse.com/library/checking-values
![Andrew Chalkley](https://uploads.teamtreehouse.com/production/profile-photos/26170/micro_TeacherShoot-Andrew.jpg)
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](https://secure.gravatar.com/avatar/33d999faac7e83c3a04899438af340db?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
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](https://uploads.teamtreehouse.com/production/profile-photos/26170/micro_TeacherShoot-Andrew.jpg)
Andrew Chalkley
Treehouse Guest Teacherreturn reqval;}
is in the each loop. Put it after the );
and before };