title: Converting HTML form input into Javascript variables and comparing values
body: <p>I am trying to compare the birth dates of two people. Person 1 and Person 2 input their names and dates of birth in an HTML form, and I want to use Javascript to compare the two dates and print out which person is older on the HTML page. However, I'm not sure how to submit the form and compare the dates. Here is what I have so far for the HTML:</p>
  
  <pre><code>&lt;form id="form1"&gt;
    Full name of first person: &lt;input type="text" name="name1"&gt;&lt;br&gt;
    Birthday: &lt;input type="date" date="date1"&gt;&lt;br&gt;
    &lt;br&gt;
    Full name of second person: &lt;input type="text" name="name2"&gt;&lt;br&gt;
    Birthday: &lt;input type="date" date="date2"&gt;&lt;br&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And the Javascript: </p>
  
  <pre><code> var name1 = document.getElementsByName("name1");
   var name2 = document.getElementsByName("name2");
   var date1 = document.getElementsByName("date1");
   var date2 = document.getElementsByName("date2");
  </code></pre>
  
  <p>How do I submit the variables in HTML and then have Javascript compare the two dates?</p>