Skip to content

Instantly share code, notes, and snippets.

@mackhowell
Forked from anonymous/index.html
Last active August 29, 2015 14:06
Show Gist options
  • Save mackhowell/6d2ac94d29767052e3c6 to your computer and use it in GitHub Desktop.
Save mackhowell/6d2ac94d29767052e3c6 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-git2.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
$(document.activeElement).on('keydown', function(e) {
switch (e.which) {
// key code for left arrow
case 37:
console.log('left arrow key pressed!');
break;
// key code for right arrow
case 39:
console.log('right arrow key pressed!');
break;
}
});
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-git2.js"><\/script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">$(document.activeElement).on('keydown', function(e) {
switch (e.which) {
// key code for left arrow
case 37:
console.log('left arrow key pressed!');
break;
// key code for right arrow
case 39:
console.log('right arrow key pressed!');
break;
}
});</script></body>
</html>
$(document.activeElement).on('keydown', function(e) {
switch (e.which) {
// key code for left arrow
case 37:
console.log('left arrow key pressed!');
break;
// key code for right arrow
case 39:
console.log('right arrow key pressed!');
break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment