Skip to content

Instantly share code, notes, and snippets.

@carloscarcamo
Created May 24, 2014 14:46
Show Gist options
  • Save carloscarcamo/f5c1f7b068bb68e6f4b8 to your computer and use it in GitHub Desktop.
Save carloscarcamo/f5c1f7b068bb68e6f4b8 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<input type="text" id="key" name="key"/>
</body>
</html>
$(document).ready(function(){
$('#key').keyup(function(e){
var keycode = e.keyCode || e.which;
if(keycode >= 37 && keycode <= 40){
alert("Arrow pressed");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment