Avatar of sharingsunshine
sharingsunshine
Flag for United States of America

asked on 

How Do I Delete A jQuery Cookie Upon Order Submission or Browser Close?

this is a follow on to the question at
https://www.experts-exchange.com/questions/29138630/JQuery-If-Test-Not-Working.html?headerLink=workspace_open_questions

Open in new window


I need the cookie to be deleted when they close the browser or submit the order.   This is the code I have to delete the cookie but it isn't going away for either reason.

jQuery('#cook').click(function(e) {
		e.preventDefault();
		document.cookie = "wantmembership=1; path=/";
document.cookie = 'wantmembership=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
          jQuery(this).css('background-color','green');
              jQuery(this).text("I Now Have A Membership!");
			});

Open in new window

Web DevelopmentjQuery* cookie

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon