title: how to save data in a cookie using jquery
body: <p>I'm trying to save certain data into cookies, in such a way that if I jump from one page to another, the data entered should be saved and retrieved back on refresh. 
  I have a link: </p>
  
  <pre><code>&lt;div class="esc-policy"&gt;
       &lt;a href="#"&gt;New Link&lt;/a&gt;    
  &lt;/div&gt;
  </code></pre>
  
  <p>before i fire the click event i need to save the entered the following data fields:</p>
  
  <pre><code>     &lt;table class="form"&gt;
         &lt;tr&gt;
            &lt;td class="label"&gt;
                  &lt;label&gt;Name*&lt;/label&gt;
                  &lt;input id="nameInput" type="text" maxlength="100"/&gt;
           &lt;/td&gt;    
          &lt;td class="label"&gt;
                 &lt;label&gt;Description&lt;/label&gt;
                 &lt;input id="descriptionInput" type="text" maxlength="200" &gt;
          &lt;/td&gt;
         &lt;/tr&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>I have something like this as my js:</p>
  
  <pre><code>if ($.cookie('back_to_url_onPage_referesh')) {
    this.name.attr("value", $.cookie('name'));
    this.description.attr("value", $.cookie('description'));
  }
  </code></pre>
  
  <p>I'm not sure of how this works though. Can someone please help!!</p>
  
  <p>Thanks in advance...</p>
  
  <p>I am able to save the values in the cookie..however I still dont get how do i retrieve it while jumping back from one url to another. Ex:i have a url: ('#/link/create') where im creating this cookie..onclick of <code>&lt;a href="#"&gt;New Link&lt;/a&gt;</code>..i need to navigate to another url '#/new-link/create', enter few form fields on that page and when i hit the Save button- <code>&lt;a href="#" class="btn"&gt;Save&lt;/a&gt;,</code> it should take me back to this url: ('#/link/create')..when i navigate between pages, the data is gone ofcourse, how to save that data on the UI side???</p>