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 trialDevelopers UA
Courses Plus Student 39,426 Pointsjquery form validation and manipulation challenge 3/3
It doesn't work. why?
function containsBlanks(){
var vals = [];
$.each($('.required input'), function(){
vals.push($(this).val());
});
return vals.indexOf('') != -1;
}
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsI think it's the inputs that have a class of required.
You're selecting input elements that are within an element with a class of "required".
Try $('.required')
Gareth Borcherds
9,372 PointsIf you want to ensure that you are selecting inputs with the class required you can use something like $('input.required') which will allow jQuery to select the correct inputs with those required elements.