title: Why do I get an Cannot set properties of null (setting 'innerHTML')
body: <p>I am making a gambling game and I am trying that when you hit the button the blue.png turns into the green.png but it tells me that I have an Unchaught TypeError. It is also giving me an error at the onclick, is there a way to take this away? I know that onclick works on images so I don't know why it doesn't work on buttons, is there another property that will do about the same thing?</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>let tokens = 100
  let left = 1
  let middle = Math.floor(Math.random() * 10);
  let right = Math.floor(Math.random() * 10);
  document.getElementById("tokens").innerHTML = formatTokens(tokens);
  
  function formatTokens(num, digits = 1) {
    var si = [{
        value: 1,
        symbol: ""
      },
      {
        value: 1E3,
        symbol: " K"
      },
      {
        value: 1E6,
        symbol: " Million"
      },
      {
        value: 1E9,
        symbol: " Billion"
      },
      {
        value: 1E12,
        symbol: " trillion"
      },
      {
        value: 1E15,
        symbol: " Quadrillion"
      },
      {
        value: 1E18,
        symbol: " Quintillion"
      },
      {
        value: 1E18,
        symbol: " Quintillion"
      },
      {
        value: 1E21,
        symbol: " Sextillion"
      }
    ];
    var rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
    var i;
    for (i = si.length - 1; i &gt; 0; i--) {
      if (num &gt;= si[i].value) {
        break;
      }
    }
    return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
  }
  
  
  function gamble() {
    if (left == 1) {
      document.getElementById("green.png").innerHTML = "&lt;img src='green.png' /&gt;";
      console.log("hi")
    }
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
    &lt;div class="sectionLeft"&gt;
      &lt;center&gt;
        &lt;div class="tokenshower"&gt;
          &lt;span id="tokens"&gt;100&lt;/span&gt; Tokens&lt;br&gt;
        &lt;/div&gt;
        &lt;br&gt;
        &lt;input type="number" size="100"&gt;
        
        &lt;div class="leftdiamond"&gt;
          &lt;img src="blue.png" width="100" height="100"&gt;
        &lt;/div&gt;
        
        &lt;div class="middlediamond"&gt;
          &lt;img src="red.png" width="100" height="100"&gt;
        &lt;/div&gt;
        
        &lt;div class="rightdiamond"&gt;
          &lt;img src="green.png" width="100" height="100"&gt;
        &lt;/div&gt;
        
        &lt;button onclick="gamble()" height="1000000px" width=2 00px&gt;daddy&lt;/button&gt;
        &lt;img id="blue" src="blue.png"&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>