Skip to content

Instantly share code, notes, and snippets.

@stephencweiss
Created January 5, 2019 02:27
Show Gist options
  • Save stephencweiss/249f377ed825a460d80cc4a9e2059010 to your computer and use it in GitHub Desktop.
Save stephencweiss/249f377ed825a460d80cc4a9e2059010 to your computer and use it in GitHub Desktop.
eventHandler with reset attached to `this`
function submitForm (event) {
event.preventDefault();
console.log(`Form submitted!`);
const name = document.querySelector('[name]').value;
console.log(`The name is --> `, name);
// Do anything else you want here
this.reset(); // <-- Our *new* money line
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment