DEV Community

jmaguero
jmaguero

Posted on

[UPDATED] How to Get Form Field Data as JSON Using Plain JavaScript

Thank you https://codepen.io/jlengstorf/
A plain JavaScript example of extracting a form's fields into an object using the field name as the key and the field value as the value. This can work in lieu of things like jQuery's .serialize() or .serializeArray(), which leave something to be desired if we need to work with the form data in JavaScript.

Discussion (0)