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

JavaScript jQuery Basics (2014) Creating a Password Confirmation Form Perform: Part 2

Alemneh Asefa
Alemneh Asefa
9,503 Points

Code is exact same....yet the confirmation field does not show up

//Problem: Hints are shown even when form is valid
//Solution: Hide and show them at appropriate times
var $password = $("#password");
var $confirmPassword = $("#confirm_password");

//Hide hints
$("form span").hide();

function passwordEvent(){
  //Find out if password is valid
  if($password.val().length > 8) {
    //Hide hint if valid
  } else {
    //else show hint

function confirmPasswordEvent() {
  //Find out if password and conformation match
  if($password.val() === $confirmPassword.val()) {
    //Hide hint if match
  } else {
    //else show hint

//When event happens on password input

//When event happens on confirmation input

2 Answers

Where your code is off is your last line. You are using passwordEvent() as your callback function when you want to be using confirmPasswordEvent().

//When event happens on confirmation input