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!

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 Perform: Part 1

Ajay Yadav
.a{fill-rule:evenodd;}techdegree seal-36
Ajay Yadav
Full Stack JavaScript Techdegree Graduate 18,261 Points

Bug in code

i am not able to find out the bug in this code.this is not working properly. Please help me. here is the code..thank you $("form span").hide();

function passwordEvent(){ if (($(this).val().lenght) > 8) { $(this).next().hide(); } else{ $(this).next().show(); } } $("#password").focus(passwordEvent).keyup(passwordEvent);

1 Answer

I guess there's one bracket too much at the beginning of the first if-condition: "if(($(this)" should be "if($(this)".

Then, you have a spelling error in $(this).val().length. It's length, not lenght.

Let me know if it works now :)