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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:33:57+00:00 2026-06-17T12:33:57+00:00

How do I split a table: I have a table that i want to

  • 0

How do I split a table:

I have a table that i want to split in different tables when the rows are to long. I made a script that measures the height of row and adds it up to the height till a specific height is met. Then the class “new-row” will be added. That is as far as I come…

Javascript jQuery

$(document).ready(function(){
  var init_height = $("table").height();   // total table height
  var max_height = 400;                    // example max height
  if(init_height > max_height) {
    var pages = Math.ceil(init_height / max_height);
  }
  var start_height = 0;                    // start counter
  $("table").find("tr").each(function(){
    start_height = start_height + $(this).height();
    if(start_height > max_height) {
      $(this).addClass("new");             // marks the new table
      start_height = 0;                    // reset counter
    }
  });

  //$(this).find('.new'); ???????????

});

HTML

<table>
  <thead>
    <tr>
      <th>Title</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Lorem</td>
      <td>Dolor sit amet..... etc</td>
    <tr>
    <!-- a lot more rows here -->
  </tbody>
</table>

In this jsfiddle you can see the rows that should begin in a new table marked red. My desired outcome would also have the theads in every new 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-17T12:33:57+00:00Added an answer on June 17, 2026 at 12:33 pm

    Most of what you want:

    http://jsfiddle.net/BCK89/1/

    $(".new").each(function () {
      $("<table>").insertAfter("table:last");
      $("<thead>").append("table:last");
      $(this).nextUntil('.new').addBack().appendTo("table:last");
    });
    

    I’m not sure whether you want to leave the .new in the old table or not. If you don’t, remove .addBack. You will also have to fill the <thead>, but that should be pretty easy.

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

Sidebar

Related Questions

I have one table with 2 columns that i essentially want to split into
I have a huge table in a database and I want to split that
I want to split rows using trigger, to 2 different tables if rows are
I have a table that is split into 3. My problem is I have
I have a table that lists people and all their contact info. I want
I have a table of items that are split on a siteId and a
I want to JOIN two table. Have no problem with that. I have problem
I have a JSplitPane with a vertical split. The top component is a table
I want to split a file(suppose a mp3) into four parts.I have tried this
I have a tab delimeted file that I want to convert into a mysql

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.