I don't know if this type of question would have been asked before but i don't care because some of their answers haven't been clear enough in my opinion. I have created a sample page which will take in a random input and store it as a cookie, which works fine. But what i want to achieve is that par example if the page was reloaded or you closed and re-opened the browser and you clicked on the textbox, the input you entered before will be available to you to use again.
Here is my Code:
<html>
<head>
<script type="text/javascript">
function cookie_Saver()
{
var cookieV = document.forms["sampleform"]["samplebox"].value;
var theDate = new Date(2014, 07, 09);
theDate = theDate.toUTCString();
document.cookie = "text="+cookieV+";expires="+theDate;
alert("Done");
}
</script>
</head>
<body>
<form name="sampleform">
Enter Cookie Text<input type="text" name="samplebox" id="samplecookiebox">
<button type="button" onclick="cookie_Saver()">Submit</button>
</form>
</body>
I want to be able to do this with html and javascript only your input would be really appreciated