javascript - Targeting $(this) within nested for each loops in jQuery -
i'm trying figure out, when iterating through list items, how target each "$(this)" equivalent within nested foreach loops. here example of problem:
$('li').each(function(){ // believe $(this) target each li item... $(this).children("li").each(function(){ // ... how can target each of these li items? doesn't $(this) target original loop? }); });
$('li').each(function(){ var $this = $(this); $this.children("li").each(function(){ $this; // parent li this; // child li }); });
Comments
Post a Comment