title: How to calculate a constant tax rate?
body: <p>This is the problem that I need to resolve.</p>
  
  <p>Create a basic webpage that includes an input form. JavaScript is to be embedded into your HTML document.</p>
  
  <p>The input form should include:</p>
  
  <p>Field for user name input
  Field for order quantity input
  Read only field for item price – set to a value of 5.31
  Read only field for order total cost
  “submit button” that does NOT use any type of form button element
  User should be able to input their name and order quantity, then click “submit”.  When “submit” is clicked, form will calculate an order total, including sales tax of 8.25%.  Once calculated, the order total form field is to be updated with a total, including dollar sign and two decimal places. An alert box should also be triggered stating the users name and a message indicating the order total including sales tax.</p>
  
  <p>Be SURE to test with your own sample data to verity your calculations are correct.</p>
  
  <p>I did the html and javascript but I can't calculate the const TAXRATE OF 8.25. The Item cost 5.31 and when the tax is included in the total, is huge amount calculated.  Thanks for your help in advance. Please check my script here:</p>
  
  <pre><code>    &lt;link rel="stylesheet" type="text/css" href="2Examp.css"&gt;
  
      &lt;script type="text/javascript"&gt;
  
          function calcOrder() {
              const TAXRATE = 8.25;
  
              var userName = document.getElementById("username").value;
              var quantity = document.getElementById("quantity").value;
              var cost = document.getElementById("cost").value;
              var extendedCost = quantity * cost;
              var taxAmount = extendedCost * TAXRATE;
              var orderCost = extendedCost + taxAmount;
  
              document.getElementById("costExtended").value = "$" + orderCost.toFixed(2);
              alert("Hello " + userName + " - Your order of " + quantity + " widgets, total $" + orderCost.toFixed(2) + ", including tax.");
  
          }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Lesson #2 - Sample Page&lt;/h1&gt;
      &lt;form action="" method="post" enctype="multipart/form-data" name="wigetCalc"&gt;
          &lt;label for="form-name"&gt;Name&lt;/label&gt;
          &lt;input name="username" id="username" type="text" maxlength="15" /&gt;&lt;br /&gt;
          &lt;label for="form-quantity"&gt;Widget order quantity&lt;/label&gt;
          &lt;input name="quantity" id="quantity" type="text" value="0" maxlength="3" /&gt;&lt;br /&gt;
          &lt;label for="cost"&gt;Widget cost&lt;/label&gt;
          &lt;input name="cost" id="cost" type="text" value="5.31" readonly="readonly" /&gt;&lt;br /&gt;
          &lt;label for="order-total"&gt;Order Total&lt;/label&gt;
          &lt;input name="costExtended" id="costExtended" type="text" readonly="readonly" /&gt;&lt;br /&gt;
  
          &lt;p onclick="calcOrder();" &gt;Process Order&lt;/p&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>