How to get link inside li with jQuery? -
my html:
<div id="mydiv"> <ul class="myclass" style="display: block;"> <li class="directory selected"> <a href="#" rel="src/fd/">fd</a> <ul class="jqueryfiletree" style="display: block;"> <li class="file ext_jpg"> <a href="#">drevilblu.jpg</a> </li> </ul> </li> </ul> </div>
i need fd
query:
var foldername = $("#mydiv").find("li.selected a").text();
but receive drevilblu.jpg
instead.
how a
inside li class="directory selected"
try following
var foldername = $("#mydiv").find("li.selected > a").text();
you need first level child of li class selected. need >
Comments
Post a Comment