Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
To delete a cookie with JQuery, set the value to null: $.cookie("name", null, { path: '/' }); Edit: The final solution was to explicitly specify the path property whenever accessing the cookie, because the OP accesses the cookie from multiple pages in different directories, and thus the default paths were different (this was not described in the original question). The solution was discovered in discussion below, which explains why this answer was accepted - despite not being correct. For some versions jQ cookie the solution above will set the cookie to string null. Thus not removing the cookie. Use the code as suggested below instead. $.removeCookie('the_cookie', { path: '/' });
23rd Jan 2021, 7:21 AM
K.S.S. Karunarathne
K.S.S. Karunarathne - avatar