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

JavaScript

jquery > Form Validation and Manipulation > Modifying Attributes Code Challenge, Q1

What am I doing wrong, here?!?

$("#").addClass("myClass yourClass");

9 Answers

Andrew Chalkley
STAFF
Andrew Chalkley
Treehouse Guest Teacher

I'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.

...oh! Feeling a little sheepish. Thanks for your help!

Hi 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
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Hi Neil

You're missing a ) after the } at the end :)

Regards Andrew

Thanks Andrew.

Hi 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
STAFF
Andrew Chalkley
Treehouse Guest Teacher

Ah 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.

Thanks for the tip, got a different bummer. I am struggling to get a grip of jquery its for nerds....ha ....ha