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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:12:57+00:00 2026-05-23T18:12:57+00:00

<ul> <li> <a class=level title= href=>A</a> <ul> <li> <a class=level title= href=>AA</a> <ul> </ul>

  • 0
<ul>

<li>
    <a class="level" title="" href="">A</a>
    <ul>
        <li>
            <a class="level" title="" href="">AA</a>
            <ul>
            </ul>
        </li>
        <li>
            <a class="level" title="" href="">AB</a>
            <ul>
                <li>
                    <a class="level" title="" href="">ABA</a>
                    <ul>
                    </ul>
                </li>
            </ul>
        </li>
        <li>
            <a class="level" title="" href="">AC</a>
            <ul>
            </ul>
        </li>
    </ul>
</li>
<li>
    <a class="level" title="" href="">B</a>
    <ul>
        <li>
            <a class="level" title="" href="">BA</a>
            <ul>
                <li>
                    <a class="level" title="" href="">BAA</a>
                    <ul>
                        <li>
                            <a class="level" title="" href="">BAAA</a>
                            <ul>
                            </ul>
                        </li>
                        <li>
                            <a class="level" title="" href="">BAAB</a>
                            <ul>
                            </ul>
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
        <li>
            <a class="level" title="" href="">BB</a>
            <ul>
            </ul>
        </li>
        <li>
            <a class="level" title="" href="">BC</a>
            <ul>
            </ul>
        </li>
    </ul>
</li>

</ul>

how get html value of parent element with jquery when a.level click

AA click  result =  A/AA
AB click    "       A/AB

ABA click  result =  A/AB/ABA
AC click    "        A/AC

BA click  result =  B/BA
BAA click    "      B/BA/BAA

BAAB click   "      B/BA/BAA/BAAB

with infinite ul li level

$('a.level').click(function(){
  //
  return(false);
}

Thank you.

  • 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-23T18:12:58+00:00Added an answer on May 23, 2026 at 6:12 pm

    The element hierarchy in your markup makes it a little complicated, but you can walk up the <ul> ancestor chain with parents() and fetch the anchor elements you’re interested in with prev().

    From there, you can map() the text content of these elements and join() the resulting array into an absolute path:

    $("a.level").click(function() {
        alert($(this).parents("ul").prev("a.level").add(this).map(function() {
            return $(this).text();
        }).get().join("/"));
    });
    

    You can see this solution in action in this fiddle.

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

Sidebar

Related Questions

I'm trying to split some html content using php's preg-match-all function: <li class=cat-item><a title=blabla
On the class level, I have created reference: System::Data::Odbc::OdbcConnection Connection; in some method I
What is a class level lock. Can you please explain with an example.
I know we cannot do this at class level but at method level we
WorkAround: I have declared a class level Public static variable and initialized with a
When initialize an entity framework context. One is to initialize at class level, such
What is the best design decision for a 'top-level' class to attach to an
I need to assign an active class to my main-level navigation rendered by wordpress.
If I set a Friend-level scope on a setter, like this... Public Class MyClass
Random quick question. The System.Web.Cache class, at what level is the information stored? On

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.