Can't get .keypress to work on my own code


#1

I'm trying out the keypress event on my own .html outside of this training. I can't figure out why it's not working:

var main = function() {
$(document).keypress(function(){
        $('.menu').animate({left: '0px'},200);
        $('body').animate({left: '285px'},200;
	})
};

$(document).ready(main);

#2

Try it with

<!doctype html>
<html>
<head>
     <meta charset="utf-8">
     <title>Untitled Document</title>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

  </head>

  <body>

  </body>
</html>