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
Lloyd Heath
10,993 PointsHelp with "Build an Interactive > Website Form Validation and Manipulation > Checking Values" Code Challenge 2/3
Having trouble getting past this challenge "Create a method called 'requiredValues' that returns an array of all the values of inputs with the class of 'required'". Here is what I have coded:
function requiredValues(){
var requiredValues = new Array();
$(".required").each(function() {
requiredValues.push($(this))
});
return requiredValues;
}
Not sure what I am doing wrong here but if someone who has gotten through this stage could get me on the right track I would be very grateful. Thanks.
11 Answers
samiff
31,206 PointsThe problem is with what you are pushing to your array. You want to push the value to the array.
Lloyd Heath
10,993 PointsThanks!!! Sam for pointing out my problem; need to pay closer attention to the documentation.
samiff
31,206 PointsI had a really hard time with that set of lessons, and I'm probably on the leaderboards for failed attempts at the challenges. Plan on grabbing a jquery book soon
ecp
838 PointsWoop woop! Teamwork :D
Travis Phifer
4,269 Pointsany good suggestions for jquery books? I have been hitting myself in the head on this journey. Cause i am stumped on this one. Thanks for any reply :)
samiff
31,206 PointsHaven't picked up a book yet, but CodeAcademy has a short jQuery course: http://www.codecademy.com/tracks/jquery
Ran through their JavaScript courses quick, and they're a nice refresher and also made understanding inheritance/prototype a bit easier.
CodeSchool also has a free jQuery course, but I haven't done it yet: http://www.codeschool.com/courses/jquery-air-first-flight
Travis Phifer
4,269 PointsThank you very much for those suggestions :)
Lloyd Heath
10,993 PointsHey Travis, Check out this link as well on smashing as a starting point; pretty good read and lots of other links to other resources. And practice, practice, practice..... As my martial arts instructor often shared with me - "practice makes permanent".
(http://coding.smashingmagazine.com/2008/09/16/jquery-examples-and-best-practices/)
Jameson Nyeholt
Courses Plus Student 3,280 PointsWhat was the solution to this... I'm still stuck on it.
James Barnett
39,199 Points@Jameson - Create a new thread and post your code in that new thread.
Jameson Nyeholt
Courses Plus Student 3,280 Points@James,
Sorry about that; it's been reposted here: http://teamtreehouse.com/forum/form-validation-and-manipulation-23