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 Basics (2014) Creating a Password Confirmation Form Perform: Part 1

Franklin Colbert
Franklin Colbert
4,868 Points

I cannot get the spans to hide

when I delete everything I can get the spans to hide, but when I add any code after that, even if it is commented out, the spans are still shown

//problem hints are shown when form is valid
//solution: hide and show hints when apporpriate



// hide hints
$("form span").hide();

//function passwordEvent() {

};
// when event happens on password input
//$("#password").focus(passwordEvent().keyup(passwordEvent(){


// find out if password is valid ie longer thatn 8 characters
  // hide hint if valid
   // else show hint
});

// when event happens on confirmation input
  // determine if password and confirmation match
  // hide hint if match
  // show hint if not

2 Answers

Ryan Chatterton
Ryan Chatterton
5,914 Points

You have two trailing } , }; which will cause js errors.

also depending where this is in your code, your javascript won't wait till those elements are on the page unless you have your javascript placed at the bottom of the page.

Try just:

$(function() {
    $("form span").hide();
});
Franklin Colbert
Franklin Colbert
4,868 Points

forgot about those curly braces! thanks!

i see what you did wrong you didn't add a fullstop when choosing the class do this : $('.form span').hide() -- add the fullstop before selecting the classes :)