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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:23:14+00:00 2026-06-12T15:23:14+00:00

I have a really complicated elements tree being rendered, with a lot of levels

  • 0

I have a really complicated elements tree being rendered, with a lot of levels and I need to dig deep into the last child to start removing from the bottom to top and I need to do this dynamically.

What i mean:

I want to start from let’s say “div” element and loop through all child elements. When I find the first child of “div” I want to go and find the children of that child.

I hope it’s clear but here is a more visual representation to help you understand:

<div> 1
    <a>1(a)</a>
    <div>1(b)
        <div>1(b)(1)
            <div>1(b)(1)(1)
                <a>1(b)(1)(1)(1)</a>
            </div>
        </div>
        <span>1(b)(2)</span>
    </div>
    <div>1(c)</div>
</div>

Considering the above structure I want: Starting from point 1 to dig into point 1(b)(1)(1)(1) dynamically(without knowing ids, classes or type) and destroy the last child(1(b)(1)(1)(1)) and then it’s parent and so on.

How can I do this?

  • 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-12T15:23:16+00:00Added an answer on June 12, 2026 at 3:23 pm

    DFS = Depth First Search.
    Here’s a simple DFS which does what you asked (if I got your requirements right) :
    http://jsfiddle.net/umkZ2/

    Each alert colors the deepest node. You may replace it with a delay or something.

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

Sidebar

Related Questions

I've got a program where a lot of classes have really complicated configuration requirements.
Hi I have a really complicated dynamic query that i want to use to
Python 3 really complicated the whole file reading process, when you have a binary
let's say I have a really complicated multidimensional array like this: Array ( [A]
I've got a really complicated query that I need do but I just can't
I'm using Rails with the JQuery plugin, and have some really complicated validations for
I have some really complicated legacy code I've been working on that crashes when
I have an object, tree . tree has a property, tree.elements . tree.elements is
I have these really complicated data files that I have processed and as each
I have created some Python code which is really complicated but it basically asks

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.