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

Why call the enableSubmitEvent function at the bottom of the script?

Won't the focus and keyup methods (along with their associated functions) take care of appropriately disabling and enabling the submit button?

2 Answers

This was posted earlier by Jason Anello, a fellow student.

"The enableSubmitEvent() function is called once on page load. This is to essentially disable the submit button since all the inputs are blank when the page first loads..."

"That function is responsible for either enabling or disabling the submit button. So if you never call it again then you won't be able to enable the submit button..."

"The idea behind .keyup(enableSubmitEvent) is that as the user is typing you can repeatedly call that function to see whether the submit button should be enabled or not..."

"You don't know what keyup is finally going to be the one where all the validation passes so you call the enableSubmitEvent every time a key goes up..."

Hope this helps

Awesome, thank you!

Terrific! that's what i'd been looking for!

Link to code/course/quiz/video?

Weird, the button I clicked to ask the question said it was linked to the specific video.

Sorry!

https://teamtreehouse.com/library/jquery-basics/creating-a-password-confirmation-form/perfect