Jquery additions debugging
<p>I cannot seem to figure out where I went wrong with this.</p>

<p>favorite
share [g+] share [fb] share [tw]</p>

<p>I'm creating a website as a small store for personal use, my main question here is how would I code a function for the additon of all of it?</p>

<p>six single check boxes for various types of peripheral devices including printer, monitors, modems or other devices with which you are familiar. Assume the basic computer system price of $500.00 and then add appropriate prices based on user checks.
Monitor 299.99 Printer 129.99 Speakers 49.99 CDRW 159.99 Scanner 129.99 Modem 49.99</p>

<p>If I add just a scanner, my total will be $629.99. If I add a modem and a monitor, my total will be $849.98. </p>

<p>I may be overlooking something simple. When I click a checkbox, it does not add to the total like it's supposed to.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Problem 9&lt;/title&gt;
&lt;script type="text/javascript" src="code.jquery.com/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(function() {
  function calculateCost() {
    var ret = 500;
    var $selected = $('input:checked', $peripherals);

    $selected.each(function() {
      ret += parseFloat($(this).attr('alt'));
    });

    return ret.toFixed(2);
  }

  function setCost() {
    $total.text(calculateCost());
  }

  var $peripherals = $('#peripherals');
  var $total = $('#total');
  $('input[type="checkbox"]', $peripherals).on('change', setCost);

  setCost();

});

&lt;/script&gt;
&lt;body&gt;
&lt;h1&gt;What peripherals do you want to add?&lt;/h1&gt;
&lt;form id="peripherals"&gt;
    &lt;input type="checkbox" name="Monitor" value="Monitor" alt="299.99"&gt;Monitor&lt;br&gt;
    &lt;input type="checkbox" name="Printer" value="Printer" alt="129.99"&gt;Printer&lt;br&gt;
    &lt;input type="checkbox" name="Speakers" value="Speakers" alt="49.99"&gt;Speakers&lt;br&gt;
    &lt;input type="checkbox" name="CDRW" value="CDRW" alt="159.99"&gt;CDRW&lt;br&gt;
    &lt;input type="checkbox" name="Scanner" value="Scanner" alt="129.99"&gt;Scanner&lt;br&gt;
    &lt;input type="checkbox" name="Modem" value="Modem" alt="49.99"&gt;Modem&lt;br&gt;
&lt;/form&gt;
&lt;p&gt;Total cost:&lt;span id="total"&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
