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

  • Home
  • SEARCH
  • 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 8740357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:07:00+00:00 2026-06-13T11:07:00+00:00

Something really strange is happening to my checkboxes checked in my table. I have

  • 0

Something really strange is happening to my checkboxes checked in my table.
I have built an Invoice calculator in a Table, you can see it here and my purpose is that once i check the inputs ( Iva or Irpef) automatically they are not calculated in the Total Amount.
As you can see in the example i have linked, if you check the Irpef Input checkbox, it works well, the Irpef is not calculated in the Total Amount. The problem is that it does not happen the same with my Input Checkbox IVA, why? The code is exactly the same.

When i try just to make them working separately, it’s fine, both work well, so it looks like that they can not work together, it might be? What’happening? I need your help on this issue.

thanks

Here the code related to the issue:

function tally(selector) {
    var total = 0;
    $('p.editable_number').each(function() {
        total += parseInt($(this).text()) || 0;
        $('#subtotal').html(total);
        if($("#iva").is(':checked')){
            $('#subtotal').html((total).toFixed(2));
            $('#total').html((total*0.00).toFixed(2));
            $('#total1').html((total*0.15).toFixed(2));
            $('#total2').html((total*0.85).toFixed(2));
        }
        else {
            $('#subtotal').html((total).toFixed(2));
            $('#total').html((total*0.21).toFixed(2));
            $('#total1').html((total*0.15).toFixed(2));
            $('#total2').html((total*1.06).toFixed(2));
        }
         if($("#irpef").is(':checked')){
            $('#subtotal').html((total).toFixed(2));
            $('#total').html((total*0.21).toFixed(2));
            $('#total1').html((total*0.00).toFixed(2));
            $('#total2').html((total*1.21).toFixed(2));
        }
        else {
            $('#subtotal').html((total).toFixed(2))
            $('#total').html((total*0.21).toFixed(2));
            $('#total1').html((total*0.15).toFixed(2));
            $('#total2').html((total*1.06).toFixed(2));
        }
        })
        }

$('#irpef').change(function() {
             tally('p#subtotal');
             tally('p#total');
             }); 
$('#iva').change(function() {
             tally('p#subtotal');
             tally('p#total');
             }); 
  • 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-13T11:07:01+00:00Added an answer on June 13, 2026 at 11:07 am

    Try this one, should be fine now. I think you were trying to do an else if and do everything a couple of times instead of once (each function). refreshed
    I added variables to keep track of the total/subtotal and vat/irpf.
    each() goes through all the p.editable_number elements, so you were executing the same code a couple of times, every time overwriting the previous results, you get the right thing because it’s the end loop that counted. Now you are just getting the values once and then calculating the relevant subtotal, vat, irpf and total values(based on the condition of vat or irpf being checked or not).

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

Sidebar

Related Questions

really strange problem. I got a very basic layout (You can see it here:
There's something really strange happening, and I'm hoping someone can figure this out for
Getting something really strange that I just can't work out. I have 3 methods
Something that I think is really strange is happening when I use die() .
Something really strange is going on here. I bought a new Mac last week,
Something really odd going on here, and I have gone round in circles trying
I'm seeing something really strange happening with some projects I'm working on. I used
We have really strange and inconsistent behavior with Linq-to-SQL here. Our application is installed
Hi something really strange is happening in the following simple program. The program takes
Something really weird is happening to my Rails app. For some strange reason, jQuery

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.