Staying Alive

Prevent your users' hard-earned text from disappearing if they leave the page.

Usage

$("#my-form").stayAlive();

That's really it. Each form element on the page requires an ID for the persistence to work. If you don't want to persist every input on a form, you can also call stayAlive on an individual input element.

If you need additional control, stayAlive accepts an options object:

scope
A string that identifies the current page, and distinguishes it from other pages on your domain. (default: window.location.pathname)
ttl
The maximum time, in milliseconds, for which a saved value will be kept.

Example

Type text in the form below, and then reload the page. You won't have lost anything! Submitting the form clears the stored values.

A critically important form