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 trialMaxwell Gover
4,246 PointsNone of the changes I make in the app.js are showing up when previewing.
None of the changes I'm making in the app.js are showing up in the browser. I'm following along exactly with the videos. Pretty frustrating. I've re-copied the CDN code from the JQuery site to the index.html but still not working.
//Problem: Hints are shown even when form is valid.
//Solution: Hide & show them at appropriate times.
//Hide hints
$("form span").hide();
//When event happens on password input
$("#password").focus(function() {
if ($(this).val().length > 8) {
$(this).next().hide();
} else {
$()this.next().show();
}
});
//Find out if password is valid
//Hide hint if valid.
//Else, show hint.
//When even happens on confirmation input
//find out if password & confirmation match.
//Hide hint if match
//Else Show hint
index.html
<!DOCTYPE html>
<html>
<head>
<title>Sign Up Form</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<form action="#" method="post">
<p>
<label for="username">Username</label>
<input id="username" name="username" type="text">
</p>
<p>
<label for="password">Password</label>
<input id="password" name="password" type="password">
<span>Enter a password longer than 8 characters</span>
</p>
<p>
<label for="confirm_password">Confirm Password</label>
<input id="confirm_password" name="confirm_password" type="password">
<span>Please confirm your password</span>
</p>
<p>
<input type="submit" value="SUBMIT">
</p>
</form>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
Thanks!
1 Answer
Maxwell Gover
4,246 PointsNevermind. I figured it out. One of my brackets was the wrong way. Wow.
mikes02
Courses Plus Student 16,968 PointsGlad you figured it out, believe it or not it's often the simplest of mistakes that trip us up, but it's always a good learning experience!
mikes02
Courses Plus Student 16,968 Pointsmikes02
Courses Plus Student 16,968 PointsMay seem obvious, but is your app.js file in the js directory? Also, have you checked your console to see if there are any JS errors?