Cost Calulator Script?

Discussion in 'HTML & Website Design' started by StargateSG, Sep 26, 2012.

  1. #1
    So far, I've got this script, but it isn't working. What it's supposed to do is:

    User can select any option they want, and when they do, the price for what they selected is displayed and added at the bottom. Here's the test page, (thats not working) and the raw code.

    protostarinc.org/pricecal.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>

    <script src="jquery.js"></script>
    <script>
    $(document).ready(function(){

    $('.label').click(function(){

    var total = 0;

    $('.option:checked').each(function(){
    total += parseInt($(this).val());
    });


    $('#total').html('$' + total);
    });

    });</script>

    </head>
    <body>

    <label><input type="checkbox" class="option" value="200" /> lol</label><br />
    <label><input type="checkbox" class="option" value="200" /> hmmm</label><br />

    <div id="total">$0</div>
    </body>
    </html>
     
    StargateSG, Sep 26, 2012 IP