title: Get input value when clicking on button in JavaScript
body: <p>I knew how to fix this but right now I just don't remember. What I am doing is dynamically create two input elements: a text-box and a button. When I press on the button I want an alert with the text-box's value</p>
  
  <pre><code>var Form = {
      Create: function() {
          var Input = document.createElement('input');
              Input.type = 'text';
          document.body.appendChild(Input);
  
          var Button = document.createElement('input');
              Button.type = 'button';
              Button.value = 'Show Value';
          document.body.appendChild(Button);
  
          Button.onclick = function() {
              alert(Input.value);
          }
      }
  }
  
  window.onload = function() { Form.Create(); }
  </code></pre>
  
  <p>When I click on the button I get an empty message, even if the text-box contains text. So, I want the function to get the content of the text-box in real-time but I just don't know how this was done.</p>