title: How to make the button to clear up the sketch?
body: <p>I'm doing a project to make an etch-a-sketch every time I hover on the grid. What I'm trying to do is to make a button to clear up all the colors made.
  <a href="https://i.stack.imgur.com/edM3u.jpg" rel="nofollow noreferrer">The sketch picture.</a></p>
  <p>I guess what I need to do is to remove the style elements while clicking the button. But I'm just note sure how to link the button with the style elements.</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>const container = document.querySelector(".container");
  
  // const table = document.createElement('div');
  // table.classList.add('grid-square');
  // table.textContent = 'hello';
  
  // container.appendChild(table);
  function makeTable(rows, cols) {
    container.style.setProperty('--grid-rows', rows);
    container.style.setProperty('--grid-cols', cols);
    for (i = 0; i &lt; (rows * cols); i++){
      const cell = document.createElement('div');
      // cell.innerText = (i + 1);
      container.appendChild(cell).className = "table";
    };
  };
  
  makeTable(16, 16);
  
  // const container = document.querySelector('.container')
  const grids = document.querySelectorAll('.table')
  grids.forEach(element =&gt; {
    element.addEventListener('mouseover', (e) =&gt; {
      e.target.style.backgroundColor = randomColor();
      console.log(e)
    })
  });
  
  function randomColor() {
    var generateColor = '#' + Math.floor(Math.random()*16777215).toString(16);
    return generateColor;
  }
  
  function resizeGrid() {
    sketchSize = prompt("Enter 1 to 100 to resize sketch");
    return sketchSize;
  }
  
  // const button = document.querySelector('button')
  // button.addEventListener('click', (e) =&gt; {
  
  // });
  
   </code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>:root {
    --grid-rows: 1;
    --grid-cols: 1;
  }
  
  .container {
    display: grid;
    /* grid-gap: 1em; */
    grid-template-rows: repeat(var(--grid-rows), 1fr);
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    /* border: 1px solid black; */
    width: 50%;
    size: 960px;
  }
  
  .table {
    padding: 1em;
    border: 1px solid coral;
    text-align: center;
    /* border: none; */
  }
  
  header {
    display: flex;
    justify-content: center;
    margin: 20px;
    gap: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;title&gt;Etch-A-Sketch&lt;/title&gt;
    &lt;script src="index.js" defer&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="index.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;header&gt;
      &lt;button class="clear-button"&gt;Clear&lt;/button&gt;
      &lt;button class="resize"&gt;Resize&lt;/button&gt;
  
    &lt;/header&gt;
    &lt;div class="container"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Cheers!!</p>