How to delete a cookie using jQuery?

后端 未结 7 2179
终归单人心
终归单人心 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:38

    You can also delete cookies without using jquery.cookie plugin:

    document.cookie = 'NAMEOFYOURCOOKIE' + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
    

提交回复
热议问题