Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
js :: get cookie value
// include jQuery before writing this function
// setting cookie example
// document.cookie = 'a=' + 10 + ';b=' + 20;
var getCookie = function (name) {
var val = $.map($.grep(document.cookie.split(';'), function (v) { return v.indexOf(name) !== -1; }), function (v) { return v.split('=')[1]; });
return val[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.