How to delete a cookie using jQuery?

后端 未结 7 2200
终归单人心
终归单人心 2020-11-27 15:27

I want to use jQuery to delete cookies; I have tried this:

$.cookie(\'name\', \'\', { expires: -1 });

But when I refresh the page, the cookie

7条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 15:39

    You can try this:

    $.removeCookie('the_cookie', { path: '/' });
    

    source: https://github.com/carhartl/jquery-cookie#readme

提交回复
热议问题