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 trialAnuj Sachdeva
13,034 PointsCan not get the hint to hide
This doesn't hide the hint even after the password's value has crossed the length of 8
//Hide hints
$("form span").hide();
//When event happens on password input
$("#password").focus(function(){
//Find out if the password is valid
if($(this).val().length > 8) {
//Hide hint if valid
$(this).next().hide();
} else {
//else show hint
$(this).next().show();
}
});
2 Answers
Josh McKenzie
8,648 PointsYour code seems correct but you need something to trigger the function to check the form field at every key press, otherwise this just runs when you focus (or click) on the password field. I'd take another gander at the video.
Tommy Leng
Front End Web Development Techdegree Student 12,417 PointsThe code is right. You just need to add a .keyup() or .keypress() before the last semicolon and pass in the same function.