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

  • Home
  • SEARCH
  • 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 4122694
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:30:53+00:00 2026-05-20T23:30:53+00:00

I am trying to get value from an HTML list <div id=test> <ul> <li>C:\

  • 0

I am trying to get value from an HTML list

<div id="test">
    <ul>     
       <li>C:\        
         <ul class="leftbutton" >                 
            <li value="List1">Folder 1</li>                 
            <li value="List2">Folder 2</li>                 
            <li value="List3">Folder 3</li>                 
            <li value="List4">Folder 4</li>                 
            <li value="List5">Folder 5</li>         
         </ul>     
      </li> 
    </ul>  
</div>

i used the following code

    $("#test li").live('click', function (event) {
        alert($(this).text());
    });

i get the alert as Folder 1 if i clicked the list1
Now my problem is that i need to get the alert as
C:\Folder 1 if i click the List1 and C:\Folder 3 if i click list3

EDIT:
I am showing here is a directory structure treeview.
there will be more levels as there can be more sub folders
updated html code shown below

<div id="test">
        <ul>     
           <li>
             <span>C:\</span>       
             <ul class="leftbutton" >                 
                <li value="List1"><span>Folder1</span></li>                 
                <li value="List2"><span>Folder2</span></li>
                   <ul>
                      <li value="SubList1"><span>SubFolder1</span></li>                 
                      <li value="SubList2"><span>SubFolder2</span></li>
                   </ul>
                <li value="List3">Folder 3</li>                 
                <li value="List4">Folder 4</li>                 
                <li value="List5">Folder 5</li>         
             </ul>     
          </li> 
        </ul>  
</div>
  • 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-20T23:30:54+00:00Added an answer on May 20, 2026 at 11:30 pm

    this worked for me:
    when i create the list i provided each list with an id
    that defines the fullpath. some of the code i have used from the above answers.

    $("#test li").live('click', function (event) {
        alert(this.id);
        event.stopPropagation();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get values from html list <li> . <ul> <li><a>Main Menu</a>
I am trying to get a value from a list box after it has
I'm trying to pass a value from a select input control on an HTML
I'm trying to get the value of my div into Javascript. It's a Drupal
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
I'm trying to get all property names / values from an Outlook item. I
I am trying to get key-value-observing to work for an NSMutableArray. Below is the
i have a label in my form, and im trying to get the value
I am trying to work out how to get the value of table cell
I am trying to insert a time only value, but get the following error

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.