Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:39:34+00:00 2026-06-14T13:39:34+00:00

I am trying to make work my price estimator using jQuery and some basic

  • 0

I am trying to make work my price estimator using jQuery and some basic javascript functions.

What I want to do is to change to value of my total variable, depending on the choices made in the dropdown menus. My prices aren’t made from a unit price, so I need to set a price for a set of options. You’ll understand by seeing my JS code (what I tried that is not working)

Here’s my fiddle.

And here’s my JS code :

var total=0;
$('#total span').text(total);


if  (document.getElementById("paperSelect").value == "14 PT 1" && document.getElementById("printedSelect").value == "Front Only" && document.getElementById("quantitySelect").value == "500" && document.getElementById("turnaroundSelect").value == "4 days")
{
total=150; 
}

Here’s my HTML code :

   <form id="calculator">

    <center>
      <label class="titleLabels">Business cards</label></center>

     <label class="formLabels">Dimensions :</label>
    <select id="sizeSelect" class="formSelects">
      <option value="3.5x2">3.5&quot; x 2&quot;</option>
      <option value="3.5x1.25">3.5&quot; x 1.25&quot;</option>
    </select>

    <label class="formLabels">Paper :</label>
    <select id="paperSelect" class="formSelects">
        <option value="14 PT 1" selected="selected">14 PT Cardstock Gloss</option>
        <option value="14 PT 2">14 PT Cardstock Matte</option>
    </select>

    <label class="formLabels">Printed :</label>
    <select id="printedSelect" class="formSelects">
        <option value="Front Only" selected="selected">Front Only</option>
        <option value="Front and Back">Front and Back</option>
    </select>

    <label class="formLabels">Quantity :</label>
    <select id="quantitySelect" class="formSelects">
            <option value="250">250</option>
            <option value="500" selected="selected">500</option>
    </select>

    <label class="formLabels">Production :</label>
    <select id="turnaroundSelect" class="formSelects">
        <option value="5 days" selected="selected">5 days</option>
        <option value="4 days">4 days</option>
    </select>

    <div id="totalBox">
        <label class="formLabels" id="total"> Total : $<span></span></label>
    </div>


<!-- hidden values -->    
    <input type="hidden" id="sizeSelect_value" value="50" name="formValues" />
    <input type="hidden" id="paperSelect_value" value="20" name="formValues" />
    <input type="hidden" id="printedSelect_value" value="0" name="formValues" />
    <input type="hidden" id="quantitySelect_value" value="25" name="formValues" />
    <input type="hidden" id="turnaroundSelect_value" value="5" name="formValues" />

    </form>​
​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:39:36+00:00Added an answer on June 14, 2026 at 1:39 pm

    Here’s a working fiddle: http://jsfiddle.net/manishie/72Jbe/3/

    Here’s the revised Javascript:

    var total=0;
    $('#total span').text(total);
    
    $('form').on('change', 'select', function() { 
        if  (document.getElementById("paperSelect").value == "14 PT 1" && document.getElementById("printedSelect").value == "0" && document.getElementById("quantitySelect").value == "30" && document.getElementById("turnaroundSelect").value == "15")
    {
        total=150; 
        $('#total span').text(total);
    }
    
    });
    

    First problem is that you were matching agains the text descriptions, not against the values for the second, third and fourth parts of the if statement.

    Second problem was that you need to attach this to the change event for the select tags.

    Third problem is that you weren’t saving the new total after it changed.

    Run the fiddle, and change the bottom value to 4 days and it will work.​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make aSmack work in my project. Created a standard project
I'm trying to make resque work with heroku. It works with my other application
I have been trying to make it work with either fwrite or fputcsv but
Erlang version: R13B01 Currently I'm struggling trying to make Erlang work with SSL. The
I have been pulling my hair out trying to make this work. I have
I had a huge problem and spend hours trying to make it work, but
So i've got a Code with Python and i'm trying to make it work
I'm trying to make Gzip compression work on xampp, right now this is in
I'm trying to make this fragment work: Version History --------------- These are the versions
i am trying to make the preloading work in such a way that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.