Created
January 12, 2020 18:08
-
-
Save seachai/acd133e7f22bb3411d480bc9e9dff306 to your computer and use it in GitHub Desktop.
Grab Form Values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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