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!

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

CSS jQuery Basics (2014) Creating a Password Confirmation Form Perform: Part 1

My password hint does not disappear after 8 characters.

//problem: hints are shown even when form is valid
//solution: hide and show at appropriate times

//hide both spans
$('form span').hide();

function passwordEvent(){
    if($(this).val().lenght > 8){
  //when password is longer than 8, hide hint
    } else {
  // show hint when password shorter thatn 8

//when click in password box
  // show hint when password shorter thatn 8
  //when password is longer than 8, hide hint

//when event happens on confirm
  //find if password matches confirmation
  //hide hint if matched
  //show hint if not match

3 Answers

Emma Willmann
.a{fill-rule:evenodd;}techdegree seal-36
Emma Willmann
Treehouse Project Reviewer

Hey Ewa - I updated your question to fix the formatting of the code. When you post code, include 3 backticks (```) on the line above and the line below. This helps to keep it it in the right format. Check out the Markdown Cheatsheet under the answer box for more info on that.

As for it not working right, in your function passwordEvent, length is spelled wrong. That's probably the issue.

Hey Emma,

Completely missed that one. I keep on misspelling length. :) Also thanks for the tip on posting code :)

It all works now :)

Federico Chin
Federico Chin
8,765 Points

It happened to me too. I misspelled the "length' and I paid the price. However, it seems to be that the hint disappears after the typing nine characters instead. Ijust adjusted the if statement from ' if ($(this).val().length > 8) ' to ' if ($(this).val().length > 7) '.