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>
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.