title: Button input submit not doing
body: <p>In all the codes that I wrote, the button does not work. The site simply reloads and that's it. Maybe this is an error not in the code, but in something else, please help
  This is my code</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;'en&quot;&gt;
      &lt;head&gt;
          &lt;title&gt;Hello&lt;/title&gt;
          &lt;script&gt;
  
              document.addEventListener('DOMContentLoaded', function() {
                  document.querySelector('form').onsubmit = function() {
                      const name = document.querySelectr('#name').value;
                      alert(`Hello, ${name}!`);
                  };
              });
  
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Hello!&lt;/h1&gt;
          &lt;form&gt;
              &lt;input autofocus id=&quot;name&quot; placeholder=&quot;Name&quot; type=&quot;text&quot;&gt;
              &lt;input type=&quot;submit&quot;&gt;
          &lt;/form&gt; 
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>