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 data-action='copy'>copy</button>
  <button data-action='cut'>cut</button>
  <button data-action='paste'>paste</button>
  <div>
    <textarea rows=20 cols=50></textarea>
  </div>
  <div class='log'></div>
</body>
</html>
 
.log {
  white-space: pre-wrap;
}
 
var textarea = document.querySelector('textarea');
var logElt = document.querySelector('.log');
function log(str) {
  logElt.textContent += str + '\n';
}
var buttons = document.querySelectorAll('button');
Array.from(buttons).forEach(button => {
  button.addEventListener('click', () => {
    textarea.focus();
    var result = document.execCommand(button.dataset.action);
    log(result);
  });
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers