<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script type="text/javascript"> $(document).keydown(function(e){ if(e.which=="13"){ $("#show").html($("#show").html()+"<br>\n"); }else{ $("#show").html( $("#show").html() + "," + e.which); } }) </script> </head> <body> <div id="show" style="background:#ffaaaa;"></div> </body> </html>