• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Save the entire contents of a form to a cookie in javascript

I would like to save the entire contents of a form by looping through the forum items (I don't know the names necessaryly) to a cookie, using javascript, so the forum can be reloaded when the user comes back to the page. Please let me know how this can be done in a browser independent way! Thanks

Nicholas Waltham
1 Solution
you'll do something like loop through the form.elements collection, adding cookies by calling:

for (var i=0;form.elements.length;i++)
     document.cookie = form.elements.name+'='+form.elements.value;

but 30 points is a little stingy.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now