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

HTML Build an Interactive Website Form Validation and Manipulation Checking Values

Code Challenge Help - What am I missing??

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

Oops! It looks like Task 1 is no longer passing.

function isValidEmail(email){
  return email.indexOf("@") != -1
}
var $required = $(".required");
function requiredValues(){
  var blanks = new Array();
 $required.each(function(){
    blanks.push($this).val() != "");
  });
required blanks.sort().pop();

3 Answers

Adrianne Geyer
Adrianne Geyer
7,180 Points
function requiredValues() {
  var blanks = new Array();
  $('.required').each(function() {
  blanks.push($(this).val());
  });
  return blanks;
}

Instead of creating a variable for the 'required' class, I simply plugged it in directly to reduce the lines of code. I only created 1 variable for the array and named it blanks

Aaron Arkie
Aaron Arkie
5,345 Points

you may have changed the code from the previous example, go back and do the challenge before this one, when you get to this challenge again don't delete or move anything from the previous example, i hope this helps!

AAaron If I remove the code from the 2nd challenge without changing the code from the first challenge there is no problem with the first challenge passing