title: how can i make my javascript to read the form value?
body: <p>i'm trying to do a form that will allow the user to see the details that he put into the fields after he clicked the button. for some reason the javascript doesn't read the values of the text the user put into the form. any help?</p>
  
  <pre><code>&lt;form&gt;
  first name:
  &lt;input type="text" autofocus autocomplete="on" placeholder="first name" required  id="first"&gt;
  last name:
  &lt;input type="text" autocomplete="on" placeholder="last name" required  id="last"&gt;
  year of birth:
  &lt;input type="number" pattern="^[0-9]{4}" id="year"&gt;
  gender:
  &lt;select id="sel"&gt;
  &lt;option selected&gt;MALE&lt;/option&gt;
  &lt;option&gt;FEMALE&lt;/option&gt;
  &lt;/select&gt;
  &lt;button id="butt"&gt;click&lt;/button&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>the javascript :</p>
  
  <pre><code>function cont(){
      function person()
  {
      this.FirstName = null;
      this.LastName = null;
      this.YearOfBirth = null;
      this.Gender = null;
      this.Weight = null;
      this.Height = null;
      this.Country = null;
      this.FullName = function()
      {
      return this.FirstName + " " + this.LastName 
      };
      this.Age = function()
      {
          var today = new Date();
          var yy = today.getFullYear();
          return yy - this.YearOfBirth;
      };
      this.toString = function()
      {
      return "this rider lives in " + this.Country + " and his name is " + this.FirstName + " " + this.LastName;  
      };  
  }
  
  var rider = new person
  rider.FirstName = document.getElementById('first').value
  rider.LastName = document.getElementById('last').value
  rider.YearOfBirth = document.getElementById('year').value
  rider.Gender = document.getElementById('sel').value
  
  document.getElementById('butt').onclick = function()
  {
  
  if (rider.FirstName != typeof ("hello") || rider.LastName != typeof("hi") || rider.YearOfBirth == isNaN)
  {
      alert ("fill all the required fields")
  }
  else
  {
  document.write(rider.FirstName + "&lt;br&gt;")
  document.write(rider.LastName + "&lt;br&gt;") 
  document.write(rider.YearOfBirth + "&lt;br&gt;")
  document.write(rider.Gender + "&lt;br&gt;")
  document.write(rider.FullName() + "&lt;br&gt;")   
  }
  
  
  } }
  </code></pre>