2

I have a list in HTML. There are several nested ul and li.When I click on a li, I want to find a deepest item in that li tag that has no ul tag inside and the li is the last item of that groups. example follow this link for example

Here is my HTML code.

Here is my approach.

$('.liclk').click(function(){
    $(this).find("li").last().css( "background-color", "red" );
});

My solution is selecting last li but not the deepest.

I am beginner in jquery.

Rajib Hossen
  • 128
  • 10
  • Try this: http://stackoverflow.com/questions/19259029/using-jquery-is-there-a-way-to-find-the-farthest-deepest-or-most-nested-child – K K Oct 23 '15 at 09:15