title: Javascript: Update price when quantity changes
body: <p>I am new to javascript and I have been working on this for 4 days now and I haven't made any progress. I have tried a bunch of different options. I saw an example like mine that worked...but it isn't working for me. :( I am trying to have the price adjust as the quantity of tickets changes. Below is the javascript and below that is the html. Any assistance is much appreciated! Thank you!</p>
  
  <pre><code>document.getElementById("totalTicketCost").value = 0 + "." + 00;
  
  function ticketCost()
  
  
  {
  
  var ticketCost = 5.5;
  
  var inputTicketQuantity = document.getElementById("inputTicketQuantity").value;
  
  var totalTicketCost = parseFloat(ticketCost) * inputTicketQuantity;
  
  
  
  if (!isNaN(totalTicketCost))
  
  
  
  
  
  document.getElementById("totalTicketCost").innerHTML = totalTicketCost;
  
  
  
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>    &lt;form onsubmit="" ="return alertDetails()" id="formPurchaseTickets" enctype="text/plain" method="post" action="mailto:cmst388@xyz.com"&gt;
          &lt;h1&gt;Ticket Purchasing Form&lt;/h1&gt;
          &lt;p class="alert"&gt;Act fast! This transaction must be completed in &lt;span id="timer"&gt;&lt;/span&gt; minutes.&lt;/p&gt;
          &lt;div class="field"&gt;
              &lt;label class="required"&gt;How many tickets would you like to purchase?&lt;/label&gt;
              &lt;input id="inputTicketQuantity" tabindex="1" required type="number" value="0" name="ticket-quantity" min="1" max="3" step="1" title="You can only buy between 1 and 3 tickets"&gt;
              $&lt;span id="totalTicketCost"&gt;0.00&lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div id="contactInfo" style="display:none;"&gt;
              &lt;div class="field"&gt;
                  &lt;label class="required"&gt;Name:&lt;/label&gt;
                  &lt;input required name="name" tabindex="2" type="text" placeholder="Enter name" pattern="[a-zA-Z\s]+" title="Enter only letters. e.g. Smith"&gt;
              &lt;/div&gt;
  
              &lt;div class="field"&gt;
                  &lt;label class="required"&gt;E-mail:&lt;/label&gt;
                  &lt;input id="inputEmail" tabindex="3" required name="email" type="email" placeholder="Enter e-mail address"  onblur="validateEmail()"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;hr&gt;
  
          &lt;input type="submit" tabindex="4" value="Purchase Tickets"&gt; &lt;input type="reset"&gt;
      &lt;/form&gt;
  
  
  
      &lt;script src="event_registration.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  </code></pre>