Javascript examples for jQuery Method and Property:keypress
HTML page react to down arrow key pressed keyboard event
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> <script type="text/javascript"> $(document).on("keydown", function (e) { e.preventDefault();//from w w w. j av a 2 s . com var code = e.which || e.keyCode; console.log(code) if (code == 40) { console.log("down arrow pressed") } }); </script> </head> <body> </body> </html>