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 8773891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:25:14+00:00 2026-06-13T18:25:14+00:00

I wanted to create a table where dynamic values are displayed in a column

  • 0

I wanted to create a table where dynamic values are displayed in a column depending on values selected by users. Below is my code for it. So basically, depending on the number of adults and number of children that are selected, the Price will be calculated. So if someone chooses 1 adult and 0 children, then the Amount for 2 Day ticket should be $235, for 3 day it will be $301 and so on. I want this done on selection change method of selectboxes. I am also not very familiar with JQuery. How do I accompalish this using JQuery?

Ages 10+:


<select id="Adult" name="Adult">
<option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>



Ages 3-9:

<select id="Child" name="Child">
<option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>

<table width="800" border="1" align="center">
  <tr>
    <td width="224">Product</td>
    <td width="246">Ages 10+</td>
    <td width="192">Ages 3-9</td>
    <td width="110">Price</td>
  </tr>
  <tr>
    <td>2 Day Ticket</td>
    <td>$235.00</td>
    <td>$223.00</td>
    <td>$<span class="amount"></span> </td>
  </tr>
  <tr>
    <td>3 Day Ticket</td>
    <td>$301.00</td>
    <td>$285.00</td>
    <td>$<span class="amount"></span></td>
  </tr>
  <tr>
    <td>4 Day Ticket</td>
    <td>$315.00</td>
    <td>$298.00</td>
    <td>$<span class="amount"></span></td>
  </tr>
  <tr>
    <td>5 Day Ticket</td>
    <td>$328.00</td>
    <td>$309.00</td>
    <td>$<span class="amount"></span></td>
  </tr>
</table>
  • 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-13T18:25:15+00:00Added an answer on June 13, 2026 at 6:25 pm

    Here is complete code to accomplish what you’re trying to do. I added some id’s to the totals. See the fiddle for a working example. It would be better to not hard code the values, but this works as a starting point.

    var numAdult = 0;
    var numChild = 0;
    
    $("#Adult").change( function(){
        numAdult = $("#Adult").val();
        calcTotals();
    });
    $("#Child").change( function() {
        numChild = $("#Child").val();
        calcTotals();
    });
    
    function calcTotals(){
        $("#2DayTotal").text(235*numAdult + 223*numChild);
        $("#3DayTotal").text(301*numAdult + 285*numChild);
        $("#4DayTotal").text(315*numAdult + 298*numChild);
        $("#5DayTotal").text(328*numAdult + 309*numChild);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to create a new property on a table in my model.. Basically
I have a table that i wanted to create some charts. Basically i need
So I wanted to create a toggle-button for a table, where I can make
I wanted to create an article database for my users I was wondering how
I'm trying to create a SQL table in PHP using the following code: $sql
I have a many to many relationship between users and groups: CREATE TABLE IF
i wanted to create a forloop which will create a table from the data
I am new to SQL Server and I wanted to create my first table
I was going over AdventureWorks2008 database and wanted to create a new table that
CREATE TABLE chartered flight(flight_no NUMBER(4) PRIMARY KEY , customer_id NUMBER(6) REFERENCES customer(customer_id) , aircraft_no

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.