Save form input values on Page1 and restore them when go to Page2 using jQuery
<p>I have this simple reg form on Page1, which redirect user for Page2 which have advanced reg form:</p>

<pre class="lang-html prettyprint-override"><code>&lt;form action="" method="post" class="signup-field" novalidate="novalidate"&gt;
  &lt;input type="text" name="first_name" value="" size="40" class=""    id="first_name" placeholder="First Name"&gt;
  &lt;input type="text" name="last_name" value="" size="40" class="" id="last_name" placeholder="Last Name"&gt;
  &lt;input type="email" name="email" value="" size="40" class="" id="email" placeholder="E-Mail"&gt;
  &lt;input type="checkbox" name="acceptance" value="1" class="" &gt;
  &lt;input class="sign-up-button" type="submit" onclick="parent.location='page2.html'" value="SIGN  UP NOW!"&gt;
&lt;/form&gt;
</code></pre>

<p>So I need to save these 4 inputs value when user click "SIGN  UP NOW!" button and when it redirect user to Page 2 form, values 'first_name', 'last_name', 'email' and  'checkbox' must be already filled in Page2 form.</p>

<p>I've tried this code on page1 for save data in SessionStorage:</p>

<pre class="lang-js prettyprint-override"><code>jQuery( document ).ready(function() {
  jQuery('.signup-field .sign-up-button').click(function() {
    sessionStorage.setItem("first_name", document.getElementById('first_name').val);
    sessionStorage.setItem("last_name", document.getElementById('last_name').val);
    sessionStorage.setItem("email", document.getElementById('email').val);
  });
});
</code></pre>

<p>And this code on page2 to restore:</p>

<pre class="lang-js prettyprint-override"><code>jQuery(document).ready(function($) {
  if (sessionStorage.getItem('first_name') == "first_name") {
    return;
  }

  var first_name = sessionStorage.getItem('first_name');
  if (first_name !== null) 
    $('#ws-plugin--s2member-custom-reg-field-first-name').val(first_name);

  var last_name = sessionStorage.getItem('last_name');
  if (last_name !== null) 
    $('#ws-plugin--s2member-custom-reg-field-last-name').val(last_name);

  var email = sessionStorage.getItem('email');
  if (email !== null) 
    $('#user_email').val(email);
});
</code></pre>

<p>However it's not working for me. What is wrong with my code?</p>