Skip to content
avoidwork edited this page Apr 24, 2012 · 1 revision

cookie

Easy cookie manipulation

Example

$.cookie.set("hw", "Hello world!", "21d"); // Creates cookie 'hw', which expires in 21 days

cookie.expire

Method

Expires a cookie

@param  {String} name Name of the cookie to expire
@return {String} Name of the expired cookie

Example

$.cookie.expire("hw");

cookie.get

Method

Gets a cookie

@param  {String} name Name of the cookie to get
@return {Mixed} Cookie or undefined

Example

var cValue = $.cookie.get("hw");

cookie.list

Method

Gets the cookies for the domain

@return {Object} Collection of cookies

Example

var cookies = $.cookie.list();

cookie.set

Method

Creates a cookie

The offset specifies a positive or negative span of time as day, hour, minute or second

@param  {String} name   Name of the cookie to create
@param  {String} value  Value to set
@param  {String} offset A positive or negative integer followed by "d", "h", "m" or "s"
@return {Object} The new cookie

Example

var objAsArray = $.array.cast(obj);