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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:48:09+00:00 2026-05-28T18:48:09+00:00

I have a table that is populated from a JSON object. The result is

  • 0

I have a table that is populated from a JSON object. The result is a table with an uneven number of cells in each row. I’m working on a script to automatically append empty cells to each row so that there is a uniform number. My problem is figuring out the length of the longest row in the table. Below is my attempt at this. However, I keep getting errors that the row is undedefined (e.g. “cannot read property length of undefined”). What have I done wrong?

function countCells() {
var columnCount;
$("#MarketsTable tr").each(function () {
    columnCount = Math.max(columnCount, $(this).cells.length);
})
return columnCount;
}
  • 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-28T18:48:10+00:00Added an answer on May 28, 2026 at 6:48 pm

    You’re mixing basic DOM/JavaScript with jQuery.

    Replace $(this).cells.length with either $(this).children('td').length or this.cells.length

    http://api.jquery.com/children/

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

Sidebar

Related Questions

I have a ListBox that gets populated with items read from a JSON response.
We have a SQL table that is populated with events from our website (mostly
I have an html table that is populated from a text file, formatted and
I have a website with a table that is populated with data from various
I have a WPF DataGrid that will be populated from a data table having
I have a table, named ReportingPeriods , that I want to be populated entirely
I have a database table on a development server that is now fully populated
I have table that I insert data with following query (from c# code): INSERT
Imagine you have a website with several drop-downs that are populated from the back-end
HI! I have a table, generated dynamic in jquery populated with data from a

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.