Hello
I would be grateful if someone could help me achieve a parent-child relationship as shown in the attachment, using the <a href> tags

Recommended Answers

All 3 Replies

Generally, just put them in nested ul 's:

<ul>
  <li><a>Something</a></li>
  <li>
    <ul>
      <li><a>Something else..</a></li>
      <li>
        <ul>
          ...
        </ul>
      </li>
    </ul>
  </li>
</ul>

By the way, this is HTML, not javascript.

You could make an object in JavaScript for each node you need and define whether it's an absolute parent (has no ancestors), a parent and a child, or an absolute chile (has no descendents). Then have a method that sets an array to define the arrays in parents, and when you instantiate it, give it a reference to the instantiation's DOM selector.

After you do that, set up a script in jQuery (what I would do at least) that goes and decides what type of node everything is and calls the methods that instantiate the objects based on where they are your ancestral order.

thanks twiss ans TySkby, but twiss' method is more appropriate as I have no jscript on the page, and need a simple parent-child view on the page

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.