Skip to content

Remove cookie problems JS-COOKIE

JS Cookies remove cookie, undefined

Hi Guys, I have trying to remove a cookie from a domain but I can’t, the console return undefined.

When I log in the cookie is set up in but after that the URL change to and keep the same cookies. The name of the cookie I want to remove is bookId, here is my try:

Cookies.set('bookId', ' ');

But instead to change the cookie value, create a new one with the domain

If I use


the console return undefined

Thanks, any help will be helpful


You can unset cookie and set the expire header time to a past date

document.cookie = "bookId=; expires=Thu, 01 Jan 1970 00:00:00 UTC";