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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:49:07+00:00 2026-06-08T08:49:07+00:00

I have the table below. I also have this array who’s values correspond to

  • 0

I have the table below. I also have this array who’s values correspond to the data-id attributes of the rows [52,24,12]. One and only one row will exist in the table for each array value. I would like to increment the count column for each row which exists in the array. For instance, 12 would change to 13, 32 would change to 33, and 6 would change to 7. A jQuery solution is preferred, however, a native JavaScript solution would suffice. Thank you

<table>
 <thead>
  <tr><td>count</td></tr>
 </thead>
 <tbody>
  <tr data-id="24"><td>32</td></tr>
  <tr data-id="52"><td>12</td></tr>
  <tr data-id="42"><td>4</td></tr>
  <tr data-id="84"><td>2</td></tr>
  <tr data-id="12"><td>6</td></tr>
 </tbody>
</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-08T08:49:08+00:00Added an answer on June 8, 2026 at 8:49 am

    Try this (I’m using lib from underscorejs.org)

    _.each([52,24,12], function (item) {
        var td = $('tr[data-id=' + item + '] td');
        td.text(parseInt(td.text()) + 1);
    });
    

    or w/o underscore:

    var a = [52,24,12]; 
    for (var i = 0; i < a.length; ++i) {
        var td = $('tr[data-id=' + a[i] + '] td');
        td.text(parseInt(td.text()) + 1);
    }
    

    http://jsfiddle.net/ACJ9r/

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

Sidebar

Related Questions

I have a table like below and its rows can be added and removed
I have a table that contains some data given below. It uses a tree
I have this javascript, jquery function, (below) It gets the text inside each table
I have a table with format below. And I also know the most common
I have this array that I am displaying with a table how can i
i have the table below <tr id=group_1>...</tr> <tr id=el>...</tr> <tr id=el>...<tr> <tr id=group_2></tr> <tr
I have a table like below: Table A ---------- ID Field1 Field2 Field3 1
I have a table as below ID Date 1 Null 1 Null 1 Null
I have a table as below Name Priority Date ------------------------- A 2 d1 B
I have a table like below: EmployeeId EmployeeName RequestId RequestName EmployeeId RequestId I need

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.