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

Jeremy Hogan
Jeremy Hogan
15,451 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,451 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'); }):