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

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

Manish Bhattarai
Manish Bhattarai
3,897 Points

!canSubmit()

why did he flip the return value of canSubmit().How does that effect enableSubmitEvent().Plz explain

P.S Andrew Chalkey is the worst tutor in treehouse.

1 Answer

Andrew Shook
Andrew Shook
31,709 Points

He flipped the return value because isPasswordValid() and arePasswordsMatching() ( the two functions called inside of canSubmit() ) both return true when the password is valid and matches the confirmation password. However, if the disabled property for a submit button is set to true then the submit button will not work. So if you don't flip it, when canSubmit() is true it will disable the submit button instead of enabling it. He explains this at time mark 6:30 of the video.