Wondering is there a function in javascript without jquery or any framework that allows me to serialize the form and access the serialized version?
my way...
const myForm = document.forms['form-name']
myForm.onsubmit=e=>
{
e.preventDefault() // for testing...
let data = Array.from(new FormData(myForm))
.reduce((r,[k,v])=>{r[k]=v;return r},{})
/*_______________________________________ same code: for beginners
let data = {}
Array.from(new FormData(myForm), (entry) => { data[ entry[0] ] = entry[1]} )
________________________________________________________________*/
console.log(data)
//...
}