11. Filling Out the Cases///


#1

mario moves perfectly but it it tells me that there is error. can you help me please?

$(document).ready(function() {
    $(document).keydown(function(key) {
        switch(parseInt(key.which,10)) {
			// Left arrow key pressed
			case 37:
				$('img').animate({left: "-=10px"}, "fast");
				break;
			// Up Arrow Pressed
			case 38:
				// Put our code here
				$("img").animate({top: "-=10px"}, "fast");
				break;
			// Right Arrow Pressed
			case 39:
				$("img").animate({left: "+=10px"}, "fast");
				break;
			// Down Arrow Pressed
			case 40:
				// Put our code here
				$("img").animate({top: "+=10px"}, "fast");
				break;
		}
	});
});

#2

Change to double quotes like so: $("img")


#3

i have replaced with $('img') with double quotes like $("img").. still its showing error.


#4

Please paste in your code and error


#5

you forgot one of these - }); at the end :smile:


#6

refresh the page ,u need to click on mario image first then press the key its works on same code.


#8

hey there!

i was stuck on this for ages as well, i have been looking through all the forums for a solution to this issue.

it appears that this lesson wants all of your selectors to look EXACTLY like this $('img')

once i removed all double quotes from my code it allowed me to move on.
hope this helps :grin:


#9