A Pen by Anders Lund

This awesome code was written by anderslund007, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright anderslund007 ©
  • HTML
  • CSS
  • JavaScript
    <section id="color">
  <input type="number" id="myInt" value="number"/>
  <button onclick="myFun()">Click</button>

<section id="box-container">


/*Downloaded from https://www.codeseek.co/anderslund007/a-pen-by-anders-lund-qreOWb */
  width: 100%;
  display: flex;
  flex-wrap: wrap;

  background-color: tomato;
  margin: 5px;
  width: 50px;
  height: 50px;
  color: white;
  font-size: 26px;
  text-align: center;

/*Downloaded from https://www.codeseek.co/anderslund007/a-pen-by-anders-lund-qreOWb */
    var html = '';
var inputNum;

function myFun(){
  inputNum = document.getElementById('myInt').value;
  for(var i = 0; i < inputNum; i+= 1){
    //Nullstill html til en verdi på null
    html += '<div>' + i + '</div>';
  document.getElementById('box-container').innerHTML += html;