title: Passing Textbox Value to another page via JavaScript
body: <p>I need to accomplish the follow:</p>
  
  <ol>
  <li>allow user to input data into a textbox attribute of form/input element</li>
  <li>after the user inputs the data and presses enter, the user is then directed to another page where the entered data is display</li>
  </ol>
  
  <p>I have the following:
  (would prefer to work with JS and HTML without involving PHP)</p>
  
  <p>Index Page:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt; Index Page &lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
  
          &lt;form&gt;
              &lt;input id = "userInput" type = "textbox" name = "firstName"&gt;
          &lt;/form&gt;
  
          &lt;script&gt;
          var inputTest = document.getElementById('userInput').value;
          localStorage.setItem( 'objectToPass', inputTest );
          &lt;/script&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Redirect Page:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;title&gt; Redirect Page &lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
  
      &lt;script&gt;
        var inputTest = localStorage['objectToPass'];
        localStorage.removeItem( 'objectToPass' ); // Clear the localStorage
        var displayData = inputTest;
        alert('Inserted Data' + inputTest);
      &lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am unable to get this to work, any help would be appreciated!</p>