Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Stuck on checking values JQuery code challenge

Question:

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

My Answer:

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

When I put this in it returns back to first task saying it no longer works but first task is correct. Can anyone help..!

Neil

4 Answers

John Locke
John Locke
15,479 Points

The jQuery classes were tough for me too. Sometimes when I get stuck, I try searching the forum to see if anyone else has found the solution. When I did a search for "code challenge jquery requiredvalues", this is one of the results that showed up. I hope this helps.

https://teamtreehouse.com/forum/jquery-challenge

This was a nightmare for me too..that Andrew Chalkley didn't really break things down the way I expected.

I am stuck on this can anyone help? Using the 'inArray' method check if the array contains the string 'Andrew'

My answer is return $.inArray(true, Andrew) != -1; When I put my answer in it does not come up with a Bummer it sends me to previous task.

Kind regards, Neil

I totally lost in some parts, the jQuery lesson doesn't seem as detail as HTML/CSS and Javascript.

HI Beatrice, yeah know what you mean I am finding it difficult to do......it is not broken down like the other projects.

I hope you find the rest ok.

Regards,

Neil