Clear Cookies - Javascript

How to clear cookies using javascript

Snippet Code


  
Rate this page :
  [ 0 votes]

Here, the created cookie is deleted using "expires" variable where you can set expiry time.

<script type='text/javascript'> document.cookie ="admin=hiox"; function clearcookie() { var date = new Date(); var expires = ';expires='+date.toGMTString(); document.cookie = "admin=hiox"+expires; } </script> <input type='button' value='delete' onclick='clearcookie()'>

Tags


Ask Questions

Ask Question