jquery-cookie

jquery, delete cookies

守給你的承諾、 提交于 2019-11-26 07:28:57
问题 I want to use JQuery to delete cookies ; I tried this $.cookie(\'name\', \'\', { expires: -1 }); Then I refresh the page and the cookie is still there : alert(\'name:\' +$.cookie(\'name\')); Why? Thanks 回答1: 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