Skip to content

Instantly share code, notes, and snippets.

@seachai
Created January 12, 2020 18:08
Show Gist options
  • Save seachai/acd133e7f22bb3411d480bc9e9dff306 to your computer and use it in GitHub Desktop.
Save seachai/acd133e7f22bb3411d480bc9e9dff306 to your computer and use it in GitHub Desktop.
Grab Form Values
const form = document.querySelector('form')
// Will grab all values from the current form and create a key : value pair
Object.values(form).reduce((obj,field) => {
obj[field.name] = field.value;
return obj
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment