Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript jQuery Basics (2014) Creating a Password Confirmation Form Perform: Part 2

What am I doing wrong?

//Problem: Hints are shown even when form is valid
   //Solution: Hide and show them at appropriate times
       var $confirmPassword = $("#confirm_password");
       var $passWord = $("#password");                       
   //Hide hints
      $("form span").hide();

   function passwordEvent(){
       //Find out if password is valid  
    if($(this).val().length > 8) {
       //Hide hint if valid
      $(this).next().hide();
      } else {
      //else show hint
      $(this).next().show();
     }
  }

   function confirmEvent(){
      if($passWord.val() === $confirmPassword.val()){
     $confirmPassword.next().hide();
   } else {
      $confirmPassword.next().show();
   }
   //When event happens on password input
     $passWord.focus(passwordEvent).keyup(passwordEvent).focus(confirmEvent).keyup(confirmEvent);;

  //When event happens on confirmation input
     $confirmPassword.focus(confirmEvent).keyup(confirmEvent).keyup(passwordEvent);

MODERATOR Edited: Added Markdown to the post so the code is readable in the Community. Please refer to the Markdown CheatSheet when posting code in the Community Forums.

2 Answers

Here are some syntax errors I fount

// line 26  Unnecessary semicolon.
// line 19  Unmatched '{'.
// line 29  Unrecoverable syntax error. (100% scanned).

the most important one would be that your function doesn't have a closing }. That is most likely your problem.

I hope this helps.

Thank you!