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 Perfect

For Input confirmation with jQuery

Hi I hope someone can answer question I have regarding previous task. Please check snapshot https://w.trhou.se/zt1kff4juj Everything on file is without mistakes but i don't really understand how the submit function works in this instance .....

function canSubmit() { return usernamePresent() && isPasswordValid() && arePasswordsMatching(); }

Once user name is present, password is valid (with regards to length) and passwords are matching submit button should work (on click it should take me in this instance to non-existing file). But if one of the inputs are not valid or present submit button wont work. If I fill everything in order - first: username ; second: password ; third : password confirmation button works fine however if i first type in password , confirm password and THEN last username button doesn't work.. Shouldn't there be the case button should work regardless of which order user types in inputs as long as they are valid? Regards

2 Answers

Steven Parker
Steven Parker
231,275 Points

:point_right: You stlll need an event handler for the user name.

The canSubmit function is good, and it gets called by the enableSubmitEvent function whenever a key is released in the password or confirm boxes. Yet nothing similar is done for the user name box.

But you could add it:

//When event happens on username input
$username.keyup(enableSubmitEvent);

Thank you Steven, that solved it!