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

Steve Leichman
Steve Leichman
7,008 Points

jQuery Code Challenge - Checking Values

I'm on Challenge task 2 of 3 which requires me to: Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'.

Here is my code:'''

<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="app.js"></script> <script type="text/javascript">

var $required = $(".required");

        function isValidEmail(email){
        return email.indexOf("@") != -1;

    }

function requiredValues(){
  var blanks = new Array();
  $required.each(function(){
    blanks.push($(this).val() == "");

  });
  return blanks.sort().pop();
}

</script>'''

I'm tired of the error message telling me there's something wrong with my method. I'm well aware of that. I wish I knew what it was.

Any help would be appreciated. Thank you.

2 Answers

Greg Barbosa
Greg Barbosa
9,874 Points

Nevermind my answer.

Steve Leichman
Steve Leichman
7,008 Points

I figured this one out via an old post. But now I'm stumped on the third task. The answer had nothing to do with what we learned in the video. It was frustrating.