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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:03:29+00:00 2026-06-08T02:03:29+00:00

I have an HTML table with columns of input boxes, and would like the

  • 0

I have an HTML table with columns of input boxes, and would like the sum of the values in the boxes to be displayed automatically (i.e. without clicking a sum button and updates as the values in the boxes are changed). The number of rows in the table varies as it is dynamically created through velocity. Below is an example HTML table, I want the sum of the values in the capacity row to be displayed. I am not really sure where to start, I have tried numerous JavaScript code and have been unable to get anything to correctly work.

 <table border = "1" id = "table">
  <TR>
        <TH>Resource</TH> 
        <TH>Vacation</TH>
        <TH>Allocation</TH>
        <TH>Holidays</TH> 
        <TH>Capacity</TH>
        <TH>Remainder</TH>
    </TR>

  #foreach($user in $userList)
  <tr>
  <td>$user.resource</td>

        <td><input type=text name="vacation" size="6" maxlength="10"></td>
        <td><input type=text name="alloc" size="6" maxlength="10"></td>
        <td><input type=text name="holidays" size="6" maxlength="10"></td>
        <td><input type=text name="capacity" size="6" maxlength="10"></td>
        <td><input type=text name="remainder" size="6" maxlength="10"></td>
    </tr>
  #end 
  <tr>
  <td>Total:</td>
  <td></td><td></td><td></td>
  <td class= "capsum"><input type="text" name="captotal" size="6" maxlength="10"></td>
  <td><input type="text" name="remtotal" size="6" maxlength="10"></td>

  </tr>

  </table>

There will be multiple rows in the table, and each input box in the capacity column shares the same name. So the sum of the Capacity column should be displayed in the “capsum” input box, and should be calculated automatically and update as the values in the input boxes are changed.

  • 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-08T02:03:30+00:00Added an answer on June 8, 2026 at 2:03 am

    Something like this:

    $('table#table input[name=capacity]').change(function()
    {
     var sum = 0;
    
     $('table#table input[name=capacity]').each(function()
     {
      sum += parseInt($(this).val());
     });
    
     $('input[name=captotal]').val(sum);
    });
    

    http://jsfiddle.net/H7DSX/10/

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

Sidebar

Related Questions

I have a simple HTML Table (10 columns x 500 rows). When the page
I have an html table with one of the headers spanning over 2 columns.
I am having a HTML table with many rows. I have seven columns in
I have a table in HTML which has three columns i.e Error - User
see fiddle i have html table and one textbox and one button.make cell selection
I have a html table like this: Invoice# Due Date Balance Select 12345 12/25/2011
I have an HTML table that contains some 500 rows. I have an input
I have a html table which consists of columns for days, and rows for
I have a HTML table which consists of 5 columns. Above the HTML table,
I have a html table with a column of text boxes ( mileage ),

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.