For an assignment I had a few weeks ago we were asked to create two divs, one which collects and saves diary entries and one which displays the diary entries. We were asked to use the HTML form element and this should be proccessed using JS. Since it wasn't a server-side assignment were were asked to store the submitted diary entries using cookies I didn't get the assignment out and since the lecturer never posted the solution or went through a solution I was wondering if someone would be able to look at mine and show me how to do it. I was unsure how to actually set the cookie and return it. I'll also post a link to the js fiddle if that helps anyone. 
So in short, I want to be able to save the values of the input box one the save entry button is clicked, and show this value once show diary is clicked

Thanks in advance

```
HTML
    <form name ="name" onsubmit="return doSomething();">
        Please Enter Your Diary Entry: <input type="text" name=“somename” id="frm_somename"/>
        <input type="submit" name="Submit" value="Save Entry" />
    </form>
    <div id = "1">
        <button id="button" onclick="y();">Show Diary</button>
    </div> 
JS
    doSomething = function() {
     // get the data from the form
     var textValue = document.getElementById("frm_somename").value;
     // the rest of the code goes here

 // return false to stop form going somewhere - NB
 return false;
}

```

Here's the link for the js fiddle also if that's any help <https://jsfiddle.net/jon123/m957kc84/>