Skip to content

Instantly share code, notes, and snippets.

@tyomo4ka
Created June 9, 2015 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyomo4ka/6972d08a8b291fe8e911 to your computer and use it in GitHub Desktop.
Save tyomo4ka/6972d08a8b291fe8e911 to your computer and use it in GitHub Desktop.
for (var i = 0; i < 5; i++) {
var btn = document.createElement('button');
btn.appendChild(document.createTextNode('Button ' + i));
btn.addEventListener('click', function(){ console.log(i); });
document.body.appendChild(btn);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment