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
Chase Prescott
10,109 PointsWhen I type a password in the password field greater than 8 characters the input disappears not the hint. Fix it.
$("form span").hide();
function passwordEvent(){
//Find out if password is valid
if($(this).val().length > 8) {
//Hide hint if valid
$(this).hide();
} else {
//else show hint
$(this).next().show();
}
}
//When event happens on password input
$("#password").focus(passwordEvent).keyup(passwordEvent);
MODERATOR Edit Added markdown to code for readability and changed category of question to reflect the proper topic.
1 Answer
Billy Bellchambers
21,689 PointsHi Chase,
Without seeing all the code I can only guess but seeing as the problem occurs when the password length is greater than 8 , I would think the problem is occurring in the first part of your if statement.
$("form span").hide();
function passwordEvent(){ //Find out if password is valid
if($(this).val().length > 8) {
//Hide hint if valid
$(this).next().hide(); } //--<error is here yours read $(this).hide(), looking at else statement to hide hint if guess you missed the .next{} selector
else { //else show hint
$(this).next().show(); } }
//When event happens on password input
$("#password").focus(passwordEvent).keyup(passwordEvent);
Hope that helps.