Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <button id="reset">RESET</button>
  <output id="op"></output>
</body>
</html>
 
var op = document.getElementById('op'),
    btn = document.getElementById('reset');
document.addEventListener('keydown', function (e) {
  op.innerHTML += '<p>KEYDOWN</p>';
  console.log(e.keyCode);
}, false);
document.addEventListener('keypress', function (e) {
  op.innerHTML += '<p>KEYPRESS</p>';
  console.log(e.keyCode);
}, false);
btn.addEventListener('click', function () {
  op.innerHTML = '';
  console.clear();
}, false);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
ImpressiveWebspro
0viewers