Why is my code snippet not returning an alert?

Here is code:

document.addEventListener("DOMContentLoaded", () => {
  event.preventDefault();
  document.querySelector("#submit").onsubmit;
  () => {
    if (
      document.querySelector("#input").value === "" ||
      document.querySelector("#input").value === null
    ) {
      alert("Please enter your name.");
      return false;
    }
    let name = document.querySelector("#input").value;
    alert("Hello, " + name + "!");
  };
});
<form>
  <input id="input" placeholder="Name" type="text" autofocus autocapitalize="words" />
  <input id="submit" type="submit" />
</form>

When i run this code snippet it adds a question mark to the end of the url but doesn’t do an alert, any and all help appreciated

i’ve tried using the id called input instead of submit in the onsubmit but that gave the same result