Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<button id="btn_rv" onclick="create_another_button(this)" data-counter="1">Main Button</button>
</body>
</html>
 
function create_another_button(elm) {
  var counter = parseInt(elm.getAttribute('data-counter'));
  var button = document.createElement('button');
  button.innerText = elm.id + '_' + counter;
  button.id = elm.id + '_' + counter;
  button.setAttribute('data-counter', '1');
  button.setAttribute('onclick','create_another_button(this)');
  document.body.appendChild(button);
  elm.setAttribute('data-counter', ++counter)
}
Output

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

Dismiss x
public
Bin info
moshfeupro
0viewers