title: Add a class iteratively with javascript
body: <p>I'm creating a grid 16x16 with javascript. I also want the grid to do something when the mouse hover over each square. The problem is that I do not know how to add a class in a iterative way that every div get the same class.</p>
  
  <p>Doing so, I would make jQuery do the action with one function applied to that class.</p>
  
  <p>This is my present code</p>
  
  <pre><code>var contador = 1;
  var outra = document.createElement('div');
  outra.id = 'container';
  document.body.appendChild(outra);
  
  for (i=1;i&lt;=16;i++){
    for (j=1;j&lt;=16;j++){
      var divCreation = document.createElement('div');
      var created = divCreation;
      created.id = "numero"+ contador;
      console.log(created.id); 
      created.textContent = ". ";
      contador = contador + 1;
      outra.appendChild(created);
    }
  }
  
  $('#numero'+contador).hover(function(){
    $(this).css('background-color','yellow');
  });
  </code></pre>