FrontEnd.ro logo
Use The Platform #2

const form = document.querySelector("form");
form.addEventListener("submit", (event) => {
  event.preventDefault();

  const formData = new FormData(event.currentTarget);
  console.log(Object.fromEntries(formData));
  // { username: "bob", age: "27" }
});