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


Code Challenge JQuery

Ok so I promised myself I would ask but I have been seriously working through this badge and code challenge all afternoon and its driving me nuts.

Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'. The first function is the answer to the previous code challenge - which I passed.

Can anyone tell me what is wrong with the second function please.

function isValidEmail (email) {
    return email.indexOf("@") != -1;
function requiredValues () {
    var blanks = new Array(); 
    return blanks;

2 Answers

Stone Preston
Stone Preston
42,016 Points

Your inputs.required needs to be a jquery object. Since .each() is a JQuery method you need to turn your CSS selector into a Jquery Object like so $("selector") . I think that will fix your issue.

edit: also it looks like you may be missing a semicolon at the end of your anonymous function block.

Legend - thank you Stone