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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:45:13+00:00 2026-05-23T22:45:13+00:00

I have an autogenerated nested list structure, like so <ul> <li>AAA</li> <li>BBB <ul> <li>111

  • 0

I have an autogenerated nested list structure, like so

<ul>
  <li>AAA</li>
  <li>BBB
    <ul>
      <li>111
        <ul>
          <li>XXX</li>
        </ul>
      </li>
      <li>222</li>
    </ul>
  </li>
  <li>CCC</li>
  ...etc...
</ul>

I want to layout in columns like so:

AAA    111    XXX
BBB    222
CCC

Using JQuery and a few CSS tags, it’s then relatively easy to create a navigation style menu. e.g. select BBB from the first column, then this makes its children appear in the second column. Any other second level depth ULs are hidden.

What’s leaving me stuck is simply how to style the list in the first place to put the depths into columns. I can add tags to each UL or LI to show the depth. But if I simply use relative positioning and move each column left, then column 1 will leave a vertical gap where each of the entries have been moved across. Absolute positioning works, but doesn’t seem too neat. Any better ideas?

  • 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-23T22:45:14+00:00Added an answer on May 23, 2026 at 10:45 pm

    Using recursive functions this can be quite straight-forward: http://jsfiddle.net/uvxfm/1/.

    If you want interactivity you could save which elements are children of which parent and show the appropriate ones on click.

    var $tr = $("#tr");
    
    function text(x) { // returns text without children
        return x.clone()
                .children()
                .remove()
                .end()
                .text();
    }
    
    function add(elem, level) {
        elem.children().each(function() { // iterate children
            var $this = $(this);
            var appendToThis = $tr.find("td").eq(level); // find td to append this level to
            var appendedText = text($this) + "<br>"; // text to append
            if(appendToThis.length) { // if td exists
                appendToThis.append(appendedText);
            } else { // if td doesn't exist yet
                $tr.append($("<td>").append(appendedText));
            }
            var children = $this.children();
            if(children.length) { // call recursively for children, if any
                add(children, level + 1);
            }
        });
    }
    
    add($("ul:eq(0)"), 0); // start the process
    

    References: http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html

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

Sidebar

Related Questions

I have a dbml file that was autogenerated. I want to, in code (VB.Net)
I have a WPF 4.0 DataGrid with AutoGenerated columns. I would like to only
I have a huge list of C source and header files, actually an autogenerated
We have bunch of autogenerated classes which are mostly Axis2 stubs, skeletons etc. For
I have an autogenerated class from importing a web service containing something like this
I have a question regarding a problem with L2S, Autogenerated DataContext and the use
Is there a way to have all the POJOs autogenerated that are needed when
In our ASP.NET MVC project we have a Strings.resx file and the accompanying autogenerated
I have a wcf service that randomly begins to fail, when requesting the autogenerated
How can we get an autogenerated Id from the Table While Inserting? I have

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.