@f/form-controls
v1.0.0
Published
Retrieve a list of controls from a form
Downloads
544
Readme
form-controls
Retrieve a list of control elements from a form
Installation
$ npm install @f/form-controls
Usage
var controls = require('@f/form-controls')
function serialize (form) {
return controls
.reduce(function (acc, ctrl) {
acc[ctrl.name] = ctrl.value
return acc
}, {})
}
API
formControls(form)
form
- An HTMLFormElement.
Returns: An array of input controls within form
.
License
MIT