What's the best way to retrieve form values for localStorage as a JSON string without using JQuery? I tried using a for loop but I'm having trouble.. any hints would be greatly appreciated (I'm still new at this). Thank you!
<input type="submit" name="submit" value="submitOrder" onclick="return getValues();">
var userOrder='';
function getValues(){
for(var i=0; i < document.forms[0].length - 1; i++){
console.log(document.forms[0][i]);
return false;
}
}
localStorage.setItem('userOrder',JSON.stringify(userOrder));
console.log(localStorage.getItem('userOrder'));