8. The .keydown() Event


Nothing happens but my code passed.

$(document).ready(function() {
$(document).keydown(function() {
$("div").animate({left: '+= 10px'}, 500);

I clicked in the full screen and held down a key on the keyboard but nothing happened. Tried to refresh the browser but that didn't do anything.


Hi James,

Are you clicking on the <div> and pressing the Space key after submitting your code?
You'll need to do that (or press any key, it doesn't matter which one) for it to move :slight_smile:


Yes I tried all that. Oh well, I'll take it for granted that it works. Onto the the next problem!


Try removing the space between += and 10px.


the space wont affect anything.... Unless its Codecademy's Fault.. Glad its working @textrockstar34699


A post was split to a new topic: Exercise 8 not working for me, why?


The space in left:'+= 10px' was the problem for me. Remove it and it will be fine


Same problem, I have successfully finished the section but the Red Square remains at it's place. (I followed the instruction)


@divscode24 if you used single quotes around 'div' selector, change these to double quotes, worked for me


If you need help please create your own topic with full details