title: Javascript Tip Calculator
body: <p>I'm working on a tip calculator in Javascript where the user should be able to type in the amount of the bill, push "calculate", and see both the tip and the total (which includes the bill and the tip). </p>
  
  <p>I've been working at this for a while, but can't seem to make it work correctly.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;head&gt;
  &lt;title&gt;Tip Calculator&lt;/title&gt;
  &lt;link href="style.css" rel="stylesheet" type="text/css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="wrapper"&gt;
      &lt;header&gt;
          &lt;h1&gt;Tip Calculator&lt;/h1&gt;
      &lt;/header&gt;
      &lt;form&gt;
          Amount: $&lt;input id="bill" type="text"&gt;
          &lt;br&gt;
          &lt;button onclick="calc()"&gt;Calculate&lt;/button&gt;
          &lt;br&gt;
          Tip: &lt;span id="tip"&gt;&lt;/span&gt;
          &lt;br&gt;
          Total: &lt;span id="total"&gt;&lt;/span&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;script&gt;
      function calc() {
          var bill = document.getElementById('bill').value;
          var tip = bill * .15;
          var total = bill + tip;
  
          document.getElementById("tip").innerHTML= "$"+(tip).toFixed(2);
          document.getElementById("total").innerHTML= "$"+(total).toFixed(2);         
      }
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p> </p>
  
  <p>Any suggestions?</p>