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!

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

CSS jQuery Basics (2014) Creating a Password Confirmation Form Perfect

Jonathan Leon
Jonathan Leon
18,813 Points

My form works but wont take me to 404 page, it just takes me to the form page again, is it okay?


Jonathan Leon
Jonathan Leon
18,813 Points

// Problem: Hints are shown even when forms are valid // Solution: hide and show the hints when valid var $password = $("#password"); var $confirmpassword = $("#confirm_password");

$("form span").hide();

// find out if password is valid

function isPasswordValid() {

return $password.val().length > 8 ;


function passwordEvent() {

if (isPasswordValid()) {

  //Hide hint if valid

$password.next().hide(); } else {

//else show hint 

$password.next().show(); } };

function arePasswordsMatching () {

return $password.val() === $confirmpassword.val() ; }

function confirmpasswordEvent() { // find out if password and confirmation match if (arePasswordsMatching()) { // hide hint if match $confirmpassword.next().hide(); } // else show hint else {



// when event happens on password input


// when event happens on confirmation


// if user can submit functions

function canSubmit() {

return isPasswordValid() && arePasswordsMatching();


// submit disable\enable

function enableSubmitEvent() {

$("#submit").prop("disabled" , !canSubmit());



4 Answers

Pretty sure that's cool.. happens with me too

The same thing happened with me too.