Skip to content

A small module to transform Form Input data into JSON

License

Notifications You must be signed in to change notification settings

srsajjad/form-2-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yarn add form-2-json

input fields inside the form, must have name attribute, like -

<input name='age' />

import { form2json } from 'form-2-json'
form2json(event.target)

this function will return a json

Example

document.querySelecor('form').addEventListener('submit', handleSubmit)
function handleSubmit (e) {
  e.preventDefault()
  let myjson = form2json(e.target)
  console.log(myjson)
}

About

A small module to transform Form Input data into JSON

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published