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 trialJohn McKinney
15,331 PointsWhat's wrong with my code?
When I open the preview the hints don't hide at start, they also don't hide when I finish typing in them
//Hide hints
$("form span").hide();
function passwordEvent(){
//Find out if password is valid
if($(this).val().length > 8){
//Hide if valid
$(this).next().hide();
} else {
//Else show hint
$(this).next().show();
}
//When event happens on password input
$('.password').focus(passwordEvent).keyup(passwordEvent);
//When event happens on confirmation input
//Find out if password and confirmation match
//Hide hint if matched
//Else show hint
1 Answer
Rich Donnellan
Treehouse Moderator 27,708 PointsYou're missing a curly brace to close off your passwordEvent()
function.
function passwordEvent() {
//Find out if password is valid
if($(this).val().length > 8) {
//Hide if valid
$(this).next().hide();
} else {
//Else show hint
$(this).next().show();
}
}
Cheers!
βRich
John McKinney
15,331 PointsJohn McKinney
15,331 PointsAh thank you! Those typing errors get me
Rich Donnellan
Treehouse Moderator 27,708 PointsRich Donnellan
Treehouse Moderator 27,708 PointsMost definitely. Check out JS Bin or something similar. This will help tremendously in catching any simple syntax errors we're not aware of.
Jack McDowell
37,797 PointsJack McDowell
37,797 PointsThanks for the JSBin tip Rich Donnellan, you saved me a lot of hair pulling.
Rich Donnellan
Treehouse Moderator 27,708 PointsRich Donnellan
Treehouse Moderator 27,708 PointsGlad it was helpful, Jack McDowell! It'll come in handy so much now that you'll wonder how you ever worked without it!