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 trialEwa Karweta
3,895 PointsMy 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){
$(this).next().hide();
//when password is longer than 8, hide hint
} else {
$(this).next().show();
// show hint when password shorter thatn 8
}
}
//when click in password box
$("#password").focus(passwordEvent).keyup(passwordEvent);
// 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
Treehouse Project ReviewerHey 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.
Ewa Karweta
3,895 PointsHey Emma,
Completely missed that one. I keep on misspelling length. :) Also thanks for the tip on posting code :)
It all works now :)
Emma Willmann
Treehouse Project ReviewerGlad it worked. And I tend to misspell length all the time, too. :-)
Federico Chin
8,765 PointsIt 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) '.