LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
button {
  background-color: #47cf71;
  border: none;
  border-radius: 5px;
  color: #fff;
  display: block;
  font-size: 16px;
  margin-bottom: 10px;
  padding: 15px;
  text-align: center;
  width: 200px;
}
JS
var container = document.getElementsByTagName('main')[0];

for (var i = 0; i < 5; i++) {
  var button = document.createElement('button');
  button.innerHTML = 'Button ' + i;
  button.addEventListener('click', function() {
    console.log(i); 
  });
  container.appendChild(button);
}
Term
Sat, 01/13/2018 - 16:17

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv