title: Electron - Uncaught Error: document is not defined
body: <p>I have added an event listener to my electron's main.js:</p>
  <pre><code>document.getElementById(&quot;btnEd&quot;).addEventListener(&quot;click&quot;, function (e) {
      console.log('button was clicked');
  });
  </code></pre>
  <p>The problem is that I keep getting this error:</p>
  <p>Uncaught Error: document is not defined</p>
  <p>How can I fix this?</p>