⌘I

Come svuotare un modulo dopo l'invio

Aggiornato il 10 dicembre 2025

Se vuoi che il tuo modulo venga svuotato dopo l’invio, in modo che se gli utenti fanno clic sul link “Go Back” il contenuto venga rimosso, aggiungi il seguente Javascript al tuo sito.

window.onbeforeunload = () => {
  for(const form of document.getElementsByTagName('form')) {
    form.reset();
  }
}

Hai ancora domande? oppure.