javasript get cookie code example
Example 1: javascript delete cookie
function deleteCookie(name) {
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
Example 2: js-cookie
//using js-cookie
//Setting A Cookie
Cookies.set('name', 'value')
Cookies.set('name', 'value', { expires: 7 })
Cookies.set('name', 'value', { expires: 7, path: '' })
//Reading A Cookie
Cookies.get('name') // => 'value'
//Read ALL cookies
Cookies.get()
//Delete Cookie
Cookies.remove('name')