Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$storage.set

Save data into storage.
$storage.set( name, value )
  1. name [string]
    The name of value.
  2. value [object/array/string/number/boolean]
    The data will be save into storage.

Notes

Qatrix storage function provided a great data storage capacity with over 128KB+ in IE6-7 and 5MB-10MB in browser supported local storage. The storaged data can still fetch it even the browser is closed and reloaded, or the cookie is cleaned up. It can save most of JavaScript data like object, array, string, number or boolean.

Example

HTML code
<div id="message"></div>
<button onclick="start_storage_get()">Get data from storage</button>
<button onclick="start_storage_set()">Store data to storage</button>
<button onclick="start_storage_remove()">Remove data from storage</button>
JavaScript code
function start_storage_get()
{
	var mydata = $storage.get("mydata");

	if (mydata)
	{
		$html($("message"), "The value of mydata from storage is '" + $storage.get("mydata") + "'<br />The value of data.name from storage is '" + $storage.get("mydata").name + "'");
	}
	else
	{
		$html($("message"), "No mydata from storage.");
	}
}
function start_storage_set()
{
	var data = {
		"name": "Tom",
		"age": 18,
		"city": "New York"
	};

	$storage.set("mydata", data);
	alert("The data storaged successfully. Try to close or reload the browser, or clean up the cookie and then get the value from this page");
}
function start_storage_remove()
{
	$storage.remove("mydata");
	$html($("message"), "The 'mydata' is removed");
}
Demonstration