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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:38:47+00:00 2026-06-03T19:38:47+00:00

I have a table: <div id=menu> <table cellspacing=0 cellpadding=0 width=930> <tbody> <tr> <td> 1

  • 0

I have a table:

<div id="menu">
    <table cellspacing="0" cellpadding="0" width="930">
        <tbody>
            <tr>
                <td>
                    1
                </td>
                <td class="spacer"></td>
                <td>
                    2
                </td>
                <td class="spacer"></td>
                <td>
                    3
                </td>
                <td class="spacer"></td>
                <td>
                    4
                </td>
                <td class="spacer"></td>
                <td>
                    6
                </td>
                <td class="spacer"></td>
                <td>
                    5
                </td>
            </tr>
        </tbody>
    </table>
</div>

And I need to split this table into two tables.
Like this:

<div id="menu">
    <table cellspacing="0" cellpadding="0" width="930">
        <tbody>
            <tr>
                <td>
                    1
                </td>
                <td class="spacer"></td>
                <td>
                    2
                </td>
                <td class="spacer"></td>
                <td>
                    3
                </td>
            </tr>
        </tbody>
    </table>
    <table>
        <tbody>
            <tr>
                <td>
                    4
                </td>
                <td class="spacer"></td>
                <td>
                    6
                </td>
                <td class="spacer"></td>
                <td>
                    5
                </td>
            </tr>
        </tbody>
    </table>
</div>

So I did this:
It finds the middle spacer and replaces that with some ending tags and start tags.

var menuItems = jQuery('#menu table tr td.spacer').size();
var middle = Math.floor(menuItems/2);
jQuery('#menu table tr').children('td.spacer').each(function(index) {
    if(index == middle) {
        jQuery(this).replaceWith('</tr></tbody></table><table><tbody><tr>');
    }
});

But jQuery doesn’t seem to like that… Is it possible to do this? Split an element?

  • 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-03T19:38:48+00:00Added an answer on June 3, 2026 at 7:38 pm

    try this:

    $('<table id="sec" cellspacing="0" cellpadding="0" width="930"><tbody><tr></tr></tbody></table>').insertAfter('table');
    
    var s = $('#menu td').size() / 2;
    
    $('#menu td').each(function(){
        if($(this).index() > s) {
          $(this).clone(true).appendTo("#sec tr");
          $(this).remove()
        }
    })    
    

    http://jsfiddle.net/39pLc/4/

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

Sidebar

Related Questions

<div class=header_bottom> <div class=header_bottom_right_main> <div class=header_bottom_right_menu_right> <div class=header_bottom_right_menu_right_text id=menu_header_top_right> <table width=100% border=0 cellpadding=0 cellspacing=1>
I have some simple markup: <table> <tr> <td>Menu Item</td> </tr> </table> <div> <table> <tr>
I have a table in this format. <table> <tr> <td id=divOne>div one</td> <td id=divOne>2222</td>
I have the following HTML: <div style=30px;> <table width=100%;> <tr> <td> <SELECT name=guidelinks> <OPTION
I have this strange problem I need some help with. This menu code goes
I have my div as follows <div class=menu id=admindiv runat=server> <ul> <li><a href=>welcome to
I have a table in a div , with IDs of table1 and div1
I have a table which is in a div. The length of the table
I would want to simulate the behavior of a table with div. I have
I have an html table. Here is a simplified version: <table> <tr> <td><div style=display:

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.