Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Jeremy Hogan
Jeremy Hogan
15,330 Points

Help with Jquery > Form Validation and Manipulation > Text Input Events

I am on task 2 of 2 and am being asked to "select all inputs and on the 'keydown' event select 'this' and then show the next element." When I add the code I think is correct, it makes Task 1 no longer passing for some reason and I can't figure out why. My code is:

$(".hint").hide();
$("input").keydown(function(){
$(this).next().show();
}

Thanks!

4 Answers

samiff
samiff
31,206 Points

Seems like you have a simple syntax error somewhere, the following code will pass:

$(".hint").hide();

$("input").keydown(function(){
  $(this).next().show();
});

I m finding that some of the workshop tasks need to be made clear as no where did it state remove previous line this has taken ages, can these be made clearer and why do all the videos in jQUery and PHP always get coded below the video bar so we can't actually watch the coding be written to get a clearer understanding.

On this task as others it states add the code to the previous task when in actual fact it needs removing it is confusing to newbies like myself who are tackling this for the first time.

finally cracked it through forum posts

Jeremy Hogan
Jeremy Hogan
15,330 Points

Thank you! I should've figured it was my syntax. I was missing the last ")" and semi-colon.

I just joined Treehouse and ran into this stumbling block. However, after sweating it out, I figured it out...

$('input').keydown(function () { $(this).next().show('.hint'); }):