title: How to add hover effect upon mouseover to all divs on a page?
body: <p>I have a 16x16 grid of small squares. I have added a permanent "hover" effect to make the very first box turn red when I put my mouse over it. However, I want to add the same effect to all of the boxes on the page. I can't figure out how to do it - I have tried to add an event listener to the whole page and used target.nodeName and target.NodeValue, but to no avail. I have included the working version where the fix box turns red on mouseover. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var n=16; //take grid column value as you want
  
  const bigContainer = document.querySelector('.bigContainer')
  
  for(var i = 1; i &lt; n; i++) {
      bigContainer.innerHTML+='&lt;div class="row"&gt;';
  
      for(j = 0; j &lt; n; j++) {
          bigContainer.innerHTML+='&lt;div class="smallBox"&gt;';
      }
  }
  
  const smallBox = document.querySelector('.smallBox');
  
  smallBox.addEventListener('mouseover', () =&gt; {
      smallBox.classList.add('permahover');
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.smallBox {
      border: 1px solid black;
      width: 20px;
      height: 20px;
      display: inline-block;
  }
  
  .permahover {
      background: red;
  }
  
  h1 {
      text-align: center;
  }
  
  .bigContainer {
      text-align: center;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h1&gt;Etch-a-Sketch Assignment - The Odin Project&lt;/h1&gt;
  &lt;div class="bigContainer"&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>