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

Dynamic Forms

I'm trying to build out a concept for creating accounts.

The part I just can't seem to work out is how to get the text of the "Sign In" button to update to "Sign Up" if there is a value in the "email address" input.

Once the user hits "Sign Up", if their is no text in the "password" input, it will show the span with the class .error. It's safe to say I know why JS is my least favourite out of the three haha.

Here is the link to the codepen http://codepen.io/cambourke/pen/plcdy?editors=101

I've tried to comment the JS to help give you an idea of whats going on. A massive thanks to anyone who can help out! You are a champ.

3 Answers

Its alright, I just worked out whats wrong. Didn't include a ')' at the end one of the of the events listeners.

Just remove the ()s. Then you can get the length, because it is a property.

Brad Van Skyhawk Check now man! If you can spot any rookie mistakes that would be great!

I don't know if this helps, but length is a property and not a function of string.

Anything helps haha. I'll have a go at refactoring the pen.