Skip to content

Instantly share code, notes, and snippets.

@dsheiko
Created January 31, 2020 15:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dsheiko/7a7126467357cd3f969335f5d74d5adb to your computer and use it in GitHub Desktop.
Gt cookies by name with JavaScript
function getCookie( name ) {
const value = "; " + document.cookie,
parts = value.split( "; " + name + "=" );
if ( parts.length === 2 ) {
return parts.pop().split( ";" ).shift();
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment