title: How to calculate how many days between "check-in date" and "check-out date"?
body: <p>I'm trying to figure out how to calculate the amount of days between the user's input of the check-in date and the check-out date. I need to take that number and multiple it by the room choice they selected to get the grand total cost for their stay and display it somewhere on the screen.</p>
  
  <p>I'm not entirely sure how to calculate the number of days, but for getting the cost of the room would I need to assign an id to each type of room and assign it a numerical value instead of the current setup I have now? Or how else can you assign a value to the selection of each room?</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;
     function check() {
      if(document.getElementById('checkin').value &gt; document.getElementById('checkout').value)
       { 
        alert("Check-out date must be after check-in date!")
      }
     }
     
     //function result() {
      //document.getElementById('standard').value * 
     //}
  &lt;/script&gt;
  
   &lt;body&gt;
       &lt;form&gt;
     &lt;fieldset&gt;
     &lt;legend&gt;test&lt;/legend&gt;
     First Name: &lt;br&gt;
     &lt;input type="text" name="firstname" size="45" pattern="[A-Za-z]+" title="Alphabet characters only." required&gt;
     &lt;br&gt;&lt;br&gt;
     Last Name: &lt;br&gt;
     &lt;input type="text" name="lastname" size="45" pattern="[A-Za-z]+" title="Alphabet characters only." required&gt;
     &lt;br&gt;&lt;br&gt;
     Street Address: &lt;br&gt;
     &lt;input type="text" name="street" size="45" pattern="[A-Za-z0-9 ]+" title="Alphabet characters and numbers only." required&gt;
     &lt;br&gt;&lt;br&gt;
     City: &lt;br&gt;
     &lt;input type="text" name="city" size="45" pattern="[A-Za-z ]+" title="Alphabet characters only." required&gt;
     &lt;br&gt;&lt;br&gt;
     State: &lt;br&gt;
     &lt;input list="states" name="state" size="45" required&gt;
        &lt;datalist id="states"&gt;
        &lt;option value="AL"&gt;Alabama&lt;/option&gt;
        &lt;option value="AK"&gt;Alaska&lt;/option&gt;
        &lt;option value="AZ"&gt;Arizona&lt;/option&gt;
        &lt;option value="AR"&gt;Arkansas&lt;/option&gt;
        &lt;option value="CA"&gt;California&lt;/option&gt;
        &lt;option value="CO"&gt;Colorado&lt;/option&gt;
        &lt;option value="CT"&gt;Connecticut&lt;/option&gt;
        &lt;option value="DE"&gt;Delaware&lt;/option&gt;
        &lt;option value="FL"&gt;Florida&lt;/option&gt;
        &lt;option value="GA"&gt;Georgia&lt;/option&gt;
        &lt;option value="HI"&gt;Hawaii&lt;/option&gt;
        &lt;option value="ID"&gt;Idaho&lt;/option&gt;
        &lt;option value="IL"&gt;Illinois&lt;/option&gt;
        &lt;option value="IN"&gt;Indiana&lt;/option&gt;
        &lt;option value="IA"&gt;Iowa&lt;/option&gt;
        &lt;option value="KS"&gt;Kansas&lt;/option&gt;
        &lt;option value="KY"&gt;Kentucky&lt;/option&gt;
        &lt;option value="LA"&gt;Louisiana&lt;/option&gt;
        &lt;option value="ME"&gt;Maine&lt;/option&gt;
        &lt;option value="MD"&gt;Maryland&lt;/option&gt;
        &lt;option value="MA"&gt;Massachusetts&lt;/option&gt;
        &lt;option value="MI"&gt;Michigan&lt;/option&gt;
        &lt;option value="MN"&gt;Minnesota&lt;/option&gt;
        &lt;option value="MS"&gt;Mississippi&lt;/option&gt;
        &lt;option value="MO"&gt;Missouri&lt;/option&gt;
        &lt;option value="MT"&gt;Montana&lt;/option&gt;
        &lt;option value="NE"&gt;Nebraska&lt;/option&gt;
        &lt;option value="NV"&gt;Nevada&lt;/option&gt;
        &lt;option value="NH"&gt;New Hampshire&lt;/option&gt;
        &lt;option value="NJ"&gt;New Jersey&lt;/option&gt;
        &lt;option value="NM"&gt;New Mexico&lt;/option&gt;
        &lt;option value="NY"&gt;New York&lt;/option&gt;
        &lt;option value="NC"&gt;North Carolina&lt;/option&gt;
        &lt;option value="ND"&gt;North Dakota&lt;/option&gt;
        &lt;option value="OH"&gt;Ohio&lt;/option&gt;
        &lt;option value="OK"&gt;Oklahoma&lt;/option&gt;
        &lt;option value="OR"&gt;Oregon&lt;/option&gt;
        &lt;option value="PA"&gt;Pennsylvania&lt;/option&gt;
        &lt;option value="RI"&gt;Rhode Island&lt;/option&gt;
        &lt;option value="SC"&gt;South Carolina&lt;/option&gt;
        &lt;option value="SD"&gt;South Dakota&lt;/option&gt;
        &lt;option value="TN"&gt;Tennessee&lt;/option&gt;
        &lt;option value="TX"&gt;Texas&lt;/option&gt;
        &lt;option value="UT"&gt;Utah&lt;/option&gt;
        &lt;option value="VT"&gt;Vermont&lt;/option&gt;
        &lt;option value="VA"&gt;Virginia&lt;/option&gt;
        &lt;option value="WA"&gt;Washington&lt;/option&gt;
        &lt;option value="WV"&gt;West Virginia&lt;/option&gt;
        &lt;option value="WI"&gt;Wisconsin&lt;/option&gt;
        &lt;option value="WY"&gt;Wyoming&lt;/option&gt;
       &lt;/datalist&gt;
     &lt;br&gt;&lt;br&gt;
     Zip Code: &lt;br&gt;
     &lt;input type="text" name="zipcode" size="45" pattern="[0-9]+" title="Numbers only." required&gt;
     &lt;br&gt;&lt;br&gt;
     Phone Number: &lt;br&gt;
     &lt;input type="text" name="phone" size="45" pattern="[0-9-]+" title="Numbers only." required&gt;
     &lt;br&gt;&lt;br&gt;
     E-mail: &lt;br&gt;
     &lt;input type="email" name="email" size="45" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" required&gt;
     &lt;br&gt;&lt;br&gt;
     Check-In Date:&lt;br&gt;
     &lt;input type="date" id="checkin" name="checkin" required&gt;
     &lt;br&gt;&lt;br&gt;
     Check-Out Date:&lt;br&gt;
     &lt;input type="date" id="checkout" name="checkout" required&gt;
     &lt;br&gt;&lt;br&gt;
     Room:&lt;br&gt;
     &lt;input list="rooms" name="room" size="16" required&gt;
      &lt;datalist id="rooms"&gt;
       &lt;option value="Standard ($50/night)"&gt;
       &lt;option value="Queen ($75/night)"&gt;
       &lt;option value="King ($100/night)"&gt;
       &lt;option value="Business ($125/night)"&gt;
       &lt;option value="Deluxe Suite ($150/night)"&gt;
      &lt;/datalist&gt;
     &lt;br&gt;&lt;br&gt;
     &lt;button type="submit" onclick="check()"&gt;Submit&lt;/button&gt;
     &lt;/fieldset&gt;
     &lt;/form&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>