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
Lauren Blass
1,348 Pointsjquery > Form Validation and Manipulation > Modifying Attributes Code Challenge, Q1
What am I doing wrong, here?!?
$("#").addClass("myClass yourClass");
9 Answers
Andrew Chalkley
Treehouse Guest TeacherI'm assuming you're on this challenge? http://teamtreehouse.com/library/modifying-attributes
The first step is In jQuery add the class of 'valid' to the input with the id of 'email' So your syntax is right just the contents of them.
So the selector is "#email" and the class you want to add is "valid". You don't need to add a . at the beginning since the addClass knows your adding a class.
Lauren Blass
1,348 Points...oh! Feeling a little sheepish. Thanks for your help!
Andrew Chalkley
Treehouse Guest TeacherNo worries
Neil Berriman
3,230 PointsHi Lauren, I am stuck on this:Call 'map' on the inputs with the class 'required' and return each of their values and store it in a variable named 'values'. You seem to be slightly a head of me can you help this is my code.
var $inputs = $(".required");
var values = $inputs.map(function(){
return $(this).val() == "";});
}
It returns a check of this Bummer! You haven't set the variable 'values'
Regards, Neil
Andrew Chalkley
Treehouse Guest TeacherHi Neil
You're missing a ) after the } at the end :)
Regards Andrew
Neil Berriman
3,230 PointsThanks Andrew.
Neil Berriman
3,230 PointsHi Andrew, I have done what you said to the code and still gives the same Bummer.
var $inputs = $(".required");
var values = $inputs.map(function(){
return $(this).val() == "";});})
Any thoughts..?
Regards,
Neil
Andrew Chalkley
Treehouse Guest TeacherAh sorry, that } you had before was an extra one so you don't need }) that at the end. Those are extra.
Debugging tip: The number of opening brackets should equal closing brackets.
Neil Berriman
3,230 PointsThanks for the tip, got a different bummer. I am struggling to get a grip of jquery its for nerds....ha ....ha