Started

Selectors

Utilities

Animation

AJAX

CSS

Event

Manipulation

Cookie

String

Attributes

Data

Storage

Miscellaneous

$cookie.get

Get cookie data.
$cookie.get( key )
  1. key [string]
    The key name of data saved in cookie.

Notes

The common function to read data from cookie. It also allowed to fetch Array and Object as returned value.

Example

HTML code
<div id="message"></div>
<button onclick="start_cookie_set()">Save "Hello" into cookie as name "data".</button>
<button onclick="start_cookie_get()">Get "data" from cookie</button>
<button onclick="start_cookie_remove()">Remove "data" from cookie</button>
JavaScript code
function start_cookie_get()
{
	$html($("message"), "The value of 'data' in cookie is '" + $cookie.get( "data" ) + "' and the value of 'foo' is '" + $cookie.get( "foo" ) + "'");
}
function start_cookie_set()
{
	$cookie.set("data", "Hello");
	$cookie.set({
		"world": "Hello",
		"foo": "bar"
	});

	$html($("message"), "The value is saved into cookie!");
}
function start_cookie_remove()
{
	$cookie.remove("data", "world", "foo");
	$html($("message"), "The value 'Hello' of 'data' is removed from cookie!");
}
Demonstration