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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:19:29+00:00 2026-05-27T22:19:29+00:00

I need to know how to relate several rows in a table together. I’ll

  • 0

I need to know how to relate several rows in a table together. I’ll try my best to explain.

We have a page where the client enters a list of products, description and specifications in a table. This page is managed by a CMS similar to a Rich Text editor. The layout will be something like this.

<h1>Toyota - TR - H1</h1>
<h2>Toyota Landcruiser - TR - H2</h2>
<h3>Toyota Landcruiser Tray - TR - H3  Description(td2) specifications(td3)</h3>

TR – Table Row
TD – Table Column

Now, H1 is the company name, H2 is the section and H3 is the actual product. There will be many products under a section and there can be many sections under a Company and there will be multiple Companies. The client will not be able to add classes or id’s. They will just create a new row in an existing table and will dump data. I have to load content from this file in to the main site. How do i relate all the products(H3) to its parent section(H2) and parent Company(H1)? Cannot use RegEx as there is no guarantee that the product name will be prefixed with company name. The final result should be something like below. I asked the client to use H1, H2, H3 to distinguish between products, sections and company.

http://imageupload.org/?d=3E55009E1

  • 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-27T22:19:30+00:00Added an answer on May 27, 2026 at 10:19 pm

    Try using jQuery’s nextUntil.

    Description: Get all following siblings of each element up to but not
    including the element matched by the selector, DOM node, or jQuery
    object passed.

    http://jsfiddle.net/WF4mt/2/

    //first add a class to each row containing an h1 tag so that
    //we can identify blocks of rows
    $('h1').each( function(index) {
        //add a class to each h1 tag
        $(this).closest('tr').addClass('h1row');
    });
    
    //then for each h1 row find subsequent rows that are 'children'
    $('tr.h1row').each( function(index) {
        var rows = $(this).nextUntil('tr.h1row');
        rows.addClass('y' + index);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several projects that need to write structured Textfiles, some with fixed size
I have a 'users' table with two columns, 'email' and 'new_email'. I need: A
Within our environment we have a core codebase, and several client-specific implementations of that
I have a table with several non PK-related indexes. Unfortunately there's some duplicity in
I know the question title isn't the best. Let me explain. I do a
Rookie question I know. I have a table with about 10 fields, one of
Need to know this so that i could send DTMF and that is going
I need to know about Epoll On linux System. Could you recommend manual or
I need to know how the performance of different XML tools (parsers, validators, XPath
I need to know how much space occupies all the databases inside an SQL

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.