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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:05:53+00:00 2026-05-27T23:05:53+00:00

I have a table that looks like this: http://jsfiddle.net/8SEz2/4/ Branch StSeq# Inv# Invoice Date

  • 0

I have a table that looks like this: http://jsfiddle.net/8SEz2/4/

Branch    StSeq#   Inv#  Invoice Date    Payable Amount     Pay?
Branch1     2       A2   11/11/2011        49,500.00       checkbox(unchecked)
Branch1     3       A3   11/11/2011        12,221.55       checkbox(checked)
Branch3     4       B1   11/11/2011        12,220.56       checkbox(unchecked)

What I’m trying to accomplish is when a row checkbox state is changed I need to count the number of checkboxes that are also checked that share the same branch name.

Ex. If I click on the first checkbox, (Branch1) I should get a popup with the branch checked count and in this case, it should be 2.

This is my jquery:

//Please refer to the jsFiddle for the class names
//used to track checked branches
$('input.payMe').change(function() {
    if ($(this).is(':checked')) {
    //cm enable
    var branchName = $(this).parent().prevAll("td.invoiceBranch").html().trim();
    var branchCount = 0;
    $('td.invoiceBranch').each(function(index) {
        if ($(this).html().trim() == branchName) {
            branchCount++;
        }
    });
        alert(branchCount);
    }
    else {
    //cm disable
        var branchName = $(this).parent().prevAll("td.invoiceBranch").html().trim();
        var branchCount = 0;
        $('td.invoiceBranch').each(function (index) {
            if ($(this).html().trim() == branchName) {
                //Needs to select the checkbox to get checked state.
                //Not sure if this is correct
                var inputHTML = $(this).nextAll("td.paymentCheckBox").first();
                if($(inputHTML).is(":checked")) {
                    branchCount++;
                }
            }
        });      
        alert(branchCount);
    }
}); 

Any ideas? I’ve been stumped for 2 days. Thanks!

  • 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-05-27T23:05:54+00:00Added an answer on May 27, 2026 at 11:05 pm

    I think you should apply a tag for each checkbox with the name of branch

    <input type="checkbox" class="payMe" branch="Branch1" ... />
    

    Then the function should roughly be like

    $(':checkbox.payMe').change(function() {
      alert($(':checkbox.payMe[branch="' + $(this).attr('branch') + '"]:checked').length);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a table that looks like this: ProjectID TaskID Date 000 001
i have a table that looks like this: alt text http://img405.imageshack.us/img405/3929/33732138.png another words i
I have table like this -> http://jsfiddle.net/jurisKaste/FvgeQ/ And I need to get array of
I have a table that looks like this - http://d.pr/jQ1P and then another table
I have a table that looks like this: nid vid tid 1 2 3
I have a table that looks like this: <table> <thead> <!-- random table headings
I have a table that looks like this: |StreetName NR| NR | |Teststreet 34|
I have a table that looks like this: id count 1 100 2 50
I have a table that looks like this for about ~30 students: StudentID Course*
I have a table that looks like this: ╔════╦═════════╦═════════╦═══════╗ ║ id ║ deleted ║

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.