My 'div' doesn't move to the right?I'm puzzled!


#1

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


#2

@zzhplay,
In section 10 Using .keydown()

Instructions

Inside your $(document).ready() setup,
call the .keydown() event on $(document).

$(document).keydown();

Pass .keydown() a function(){} as an input.

$(document).keydown( function() { });

Here's the twist: your function should take a single input, key,
which will help jQuery figure out which key was pressed.

$(document).keydown( function(key) { });

You could have used....

$(document).ready(function() {
     $(document).keydown(function(key) {
             var kd = parseInt(key.which,10)
             $('<p>').text(kd).prependTo('body');
     });
 });

Table ( look in Dec-collumn and beware of UPPERcase & lowercase )
http://msdn.microsoft.com/en-us/library/60ecse8t(v=vs.80).aspx


#3

Thank you for your help,I have solved it after I through the jQuery API document