var newMeal = document.getElementsByName('groceries');
var expires = new Date();
expires.setTime (expires.getTime() + 24 * 60 * 60 * 1000);
var expiryDate = expires.toGMTString();
function newCookie(add,newMeal) {
document.cookie = add + "=" + newMeal + "; expires=" + expiryDate;
}
function toShoppingList() {
window.location = "http://www.whatsfordinner.net/Testing-Insert-div.html";
}
<div id="groceries">
Shopping list for a new meal
</div>
<form onClick="toShoppingList();" "newCookie();">
<input type="button" value="Add this meal to my menu and shopping list">
</form>
Code language: JavaScript (javascript)
If it is possible to carry the entire div with a cookie, I now need to write the cookie function to read the data. Since I had success with the previous getCookie, I altered that function for the new variable function getCookie(add) { var cookieFound = false; var start = 0; var end = 0; var cookieString = document.cookie; var i = 0; //Scan the cookie for add while (i http://www.whatsfordinner.netCode language: JavaScript (javascript)
Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…