1

I need to remove some Cookies in a jQuery click function.

In HTML:

<a href="" class="btn btn-danger" type="button" id="search-this-day">Search</a>

In jQuery:

$('#search-this-day').on('click', function () {
   Cookie("fromDate",null,-1);
   // or
   deleteCookie("fromDate");
   // or
   $.cookies.del('fromDate');
});

But none have worked !

Where is my problem?

Seba99
  • 1,197
  • 14
  • 38
mySun
  • 1,550
  • 5
  • 32
  • 52

1 Answers1

1

You should use this plugin which is very helpfull for cookies managing !

Other way you should put the expire date to null like this :

$.cookie("name", null, { path: '/' });

Take care you have an 's' in your code : $.cookieS.del(..

Seba99
  • 1,197
  • 14
  • 38