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

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

Jordan Cox
Jordan Cox
8,930 Points

Strange issues with this part - Please Help!

This is a strange one.

I have checked the code over and over. I have also pasted it into jsbin. It showed no errors. The console log shows no errors.

This issue is two part. (Using Chrome)

1: I Ctrl R on the page, I get a confirm form resubmission alert - click yes, and it shows a completely blank page (nothing in console log)

2: Ctrl R again and click yes again to the resubmission alert and low and behold the page appears. (This is constant, if I refresh again, page blank, refresh, page shows...)

/* SOLVED BELOW

Password hint works but password confirm does not at all, it does not show at all or do anything regardless of what you type. Code is below. 4 eyes are better than 2 but it's frustrating and I apologise for any blatant mistakes!

Thanks in advance!

//Problem: Hints are showing 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 $password.next().hide(); } else { //else show hint $password.next().show(); } }

function confirmPasswordEvent() { //Find out if password and confirmation match if($password.val() === $confirmPassword.val()) { //Hide hint if matched $confirmPassword.next().hide(); } else { //else show hint $confirmPassword.next().show(); } }

//When event happens on password input $password.focus(passwordEvent).keyup(passwordEvent);

//When event happens on confirmation input $confirmPassword.focus(confirmPasswordEvent).keyup(confirmPasswordEvent); //Hide hint if matched //else show hint

*/

Jordan Cox
Jordan Cox
8,930 Points

SOLVED - Found the issue, indeed stupid error, forgot the # for confirm_password in the var. (What a fool!)

However, still having the refresh issue. Anyone have an idea about that?

Cheers!

Did you ever figure out what was happening with the page refresh? I finished this section up today and I have had the issue intermittently.

1 Answer

Jose Linares
Jose Linares
5,062 Points

That happens because you clicked on the submit button and you are refreshing the page you are supposed to go after you submit the information, but in this case that page does not exits.