I'm trying to save the values of a form in the LocalStorage to then pass it to JSON, all in JavaScript, I appreciate a help with this, this is the code I have.
CODE:
var theForm = document.querySelector("#form"),
valores = [];
[].forEach.call(theForm.elements,
function(elemento){
valores.push(elemento.value);
});
localStorage.form = JSON.stringify({
elementos: theForm.innerHTML,
id: theForm.id || "form",
method: theForm.method || "GET",
action: theForm.action || "",
enctype: theForm.enctype || "",
datos: valores
});