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

Checking Values 3/3

I'm not getting this at all... can anyone point me in the right direction?

function containsBlanks() {
var blanks = new Array();
$required.each(function(){
blanks.push($(this).val() == "");
});
return true;
}

6 Answers

Hi Taylor,

Sorry that you're having trouble. I'm not sure what code challenge you're on or what the task is asking you :\ Would you mind providing a little more detail?

A link to the code challenge and screenshot of the code challenge as you're working on it would be super helpful. Screenshots will help us see the code challenge your on, what it is asking you exactly, what your answer is, and what the error message or hint says to you when it pops up. :)

You can also email me directly for help at help@teamtreehouse.com! Thanks :D

I'm having the same problem. The code challenge is Build an Interactive Website / Form Validation and Manipulation / Checking Values

http://teamtreehouse.com/library/checking-values

Instructions: Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'.

Response: Bummer! There is something wrong with your code in your 'requiredValues' function.

My code:

function isValidEmail(email){
    return email.indexOf("@") != -1
}
var $required = $(".required");
var inputs = new Array();
function requiredValues(){
  $required.each(function(){
    inputs.push($(this).val());
  });
}
Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Amy,

You're close Amy!

The required function needs to return the array. You need to return inputs; at the end of the function.

Regards Andrew

I also tried this with no luck:

function isValidEmail(email){
    return email.indexOf("@") != -1;
};
var $required = $(".required");
function requiredValues(){
  var inputs = $required.map(function(){return $(this).val() == "";});
};

Thanks so much for the reply. I'll try that now.