0

Simple instant price quote calculator javascript

Hi there,

I am trying to come up with an instant price quote calculator in javascript.

Below is a sample of what I need
Price per Meal
Price per Week
Shipping & Handling included
Tax estimated
Total

Please let me know what other information I can provide to create this calculator.

4
Contributors
6
Replies
8
Views
4 Years
Discussion Span
Last Post by lps
0

Not quite understand on your question. Do you mean that all field is provided and the total should be calculated using javascript?

0

The thing here is that the site you referenced is using server-side scripting to perform the calculations. If you are going to do this client side, then you'll need to create some javascript functions that accept parameters based on what the user is choosing in the drop down lists, some logic to perform based on the parameters, and update the target element with the results.

0

Agree with JorgeM.
For example:

<html>
    <head>
    <script src='http://code.jquery.com/jquery.min.js'></script>
    <script>
        jQuery(document).ready(function(){
            jQuery('.price').live('keyup',function(){
                var total = parseInt(jQuery(this).val());
                var sib = jQuery(this).siblings('.price')
                jQuery.each(sib,function(){
                    total = total + parseInt(jQuery(this).val());
                })
                jQuery('#total').text(total);
            })
        })
    </script>
    </head>
    <body>
    <label>price1</label><input type="text" id="price1" class="price" value=""/>
    <label>price2</label><input type="text" id="price2" class="price" value=""/>
    <label>price3</label><input type="text" id="price3" class="price" value=""/>
    <div>Total=<span id="total"></span></div>
    </body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.