title: I'm trying to get value of a text input but it doesn't work correctly
body: <p>When I use <code>document.getElementById()</code> it gives me the value but it doesn't put it in my created object</p>
  
  <p>And here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script&gt;
    var People = new Array();
    var counter = 0;
  
    function Add() {
      var fname = document.getElementById('Fname').value;
      var lname = document.getElementById('Lname').value;
      var age = document.getElementById('age').value;
      var person = {
        FirstName: fname,
        LastName: lname,
        Age: age
      };
      People[counter++] = person;
    }
  &lt;/script&gt;
  
  &lt;body&gt;
    First Name &lt;input type="text" name="Fname" id="Fname" /&gt;&lt;br /&gt;
    Last Name &lt;input type="text" name="Lname" id="Lname" /&gt;&lt;br /&gt;
    Age &lt;input type="text" name="age" id="age" /&gt;&lt;br /&gt;
    &lt;input type="button" value="Add" onclick="Add()" /&gt;
    &lt;input type="button" value="Show" onclick="showP()" /&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I would be grateful if you could help me fix my problem</p>