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

I have a week and 1/2 stuck on this Jquery password question

I did everything and they I copied everything the guy did on the video and I'm still getting it wrong

http://teamtreehouse.com/library/using-focus-and-keyup

//hide
Var $password = $("password");
var $confirmPassword = $("#confirm_password");


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

function passwordEvent(){

    if($password.val().length > 8) {
    //hide hint if valid
    $password.next().hide();
  } else {
    //else show hint
    $Password.next().show();
  }
} 

function confirmPasswordEvent() {

  if($password.val() === $confirmPassword.val()) {

    $confirmPassword.next().hide();
  } else {

    $confirmPassword.next().show();
  } 
}



$password.focus(passwordEvent).keyup(passwordEvent).focus(confirmPasswordEvent).keyup(confirmPasswordEvent);    

$confirmPassword.focus(confirmPasswordEvent).keyup(confirmPasswordEvent);

3 Answers

Hi Joe,

This challenge is only asking you to add some code to line 51. Everything else should be left untouched.

It sounds like you have modified and possibly retyped the code that's in the challenge. You have several typos in this code.

I would recommend that you refresh the challenge to get the existing code back and then focus on line 51.

line 51:

$confirmPassword.keyup(enableSubmitEvent);

You want to add on to this what the instructions are asking for. You have it in your last line of code except you removed the already existing keyup handler.

thank you it was

$confirmPassword.focus(confirmPasswordEvent).keyup(confirmPasswordEvent);

You're welcome.

You're right. It does pass with that.

I would think that you should be adding on to the existing handler though.

$confirmPassword.keyup(enableSubmitEvent).focus(confirmPasswordEvent).keyup(confirmPasswordEvent);

Both pass the challenge so I'm not sure which one it's expecting you to do.

Glad you can move on though.

first Var $password the V is uppercase it has to be lowercase