doevisualizations
Version:
Data Visualization Library based on RequireJS and D3.js (v4+)
34 lines (33 loc) • 999 B
HTML
<html lang="en">
<head>
<title>jQuery Event Key</title>
<style type='text/css'>
body {font-family: verdana}
</style>
</head>
<body>
<div id='demo-html'>
<label for='key'>Type in input:</label><input id='key' />
<div>Keydown:<span id='keydown'></span></div>
<div>Keypress:<span id='keypress'></span></div>
<div>Keyup:<span id='keyup'></span></div>
</div>
<script type='text/javascript' src='../../node_modules/steal/steal.js' main='@empty'></script>
</script>
<script id="demo-source" type='text/javascript'>
steal('jquerypp/event/key',function(){
var readable = {
"\r" : "\\r",
"\b" : "\\b",
"\t" : "\\t"
};
$('#key').on('keydown keypress keyup', function(ev){
var key = ev.keyName();
$("#"+ev.type).html(readable[key] || key + ' (' + ev.keyCode + ', ' + ev.charCode + ', ' + ev.which + ')')
});
});
</script>
</body>
</html>