title: How do I get user input from input area with Java Script and assign to a variable?
body: <p>I'm trying to make a simple mad libs type game. To do so I need to do the following:</p>
  
  <ol>
  <li>Have space that user can input text</li>
  <li>Retrieve text that user inputted</li>
  <li>Assign text to variables using Javascript</li>
  <li>Place variables in Mad libs</li>
  </ol>
  
  <p>I know how to do this using something like:</p>
  
  <pre><code>var userAnswer = prompt("Give me an answer");
  </code></pre>
  
  <p>However, I want to get the input from a text input field. I was trying to do the following but I got stuck:</p>
  
  <ol>
  <li>Have input area with id="input1"</li>
  <li>Create function that takes content of #input1 and assign to a variable.</li>
  <li>Use button to run the function</li>
  </ol>
  
  <p>I will then later use these variables in my story</p>
  
  <pre><code>&lt;label for='input1'&gt;Verb + ing&lt;/label&gt;&lt;input id='input1'&gt;
  
  &lt;script&gt;
      var setInputs = function() {
          var space1 = document.getElementById("input1").innerHTML;
      }
  &lt;/script&gt;
  
  &lt;button onclick="setInputs"&gt;Click me&lt;/button&gt;
  </code></pre>
  
  <p>I'm I going about this the correct way?</p>
  
  <p>Fiddle: <a href="http://jsfiddle.net/6rjf5k9n/" rel="nofollow">http://jsfiddle.net/6rjf5k9n/</a></p>