title: addEventListener works on code pen but not on visual studio code
body: <p>I am trying to do alert("clicked") when a button is pressed but I can't get it to work on visual studio code, it only works on codepen. I run the index.html in visual studio code using an extension called open in browser.</p>
  
  <p>I tried copying the codes to codepen and it worked</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
      &lt;head&gt;       
          &lt;link rel="stylesheet" href="style.css"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class="container"&gt;
              &lt;h1&gt;Random dog Pictures&lt;/h1&gt;
              &lt;img id = "photo" src = "https://i.pinimg.com/originals/68/6d/6f/686d6fc9d01def6b6f63acded53479bc.jpg" alt = ""&gt;
              &lt;button id = "btn"&gt;Get Random Dog Photo!!!&lt;/button&gt;
          &lt;/div&gt;
          &lt;script src="randomDogPicture.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <pre><code>var btn = document.querySelector("#btn");
  
  btn.addEventListener("click", function() {
      alert("clicked");
  });
  
  </code></pre>
  
  <p>I expected it to display "clicked" but it doesn't do anything when I click the button.</p>