To delete a cookie using jQuery, set to null:
$.cookie("name", null, { path: '/' });
Edit: The final solution was to explicitly specify the path property when accessing the cookie, since the OP accesses the cookie from several pages in different directories, and thus the default paths were different (this was not described in the original question). The decision was opened in the discussion below, which explains why this answer was accepted, despite the fact that it was not correct.
For some versions of jQ cookie, the solution above will set the cookie to null. Thus, the cookie is not deleted. Instead, use the code as suggested below.
$.removeCookie('the_cookie', { path: '/' });
Chadwick Sep 08 '10 at 20:51 2010-09-08 20:51
source share