I’ve got the following UL’s setup:
<ul class="parent">
<li>
<ul class="child">
<li>
test
</li>
</ul>
</li>
</ul>
I’m trying to .append() to only “parent” with the following code:
$('ul.parent li:first-child').before(msg);
$('ul.parent:empty').append(msg);
It works, however, it’s adding msg to both the “parent” UL and the “child” UL. I know it’s because I’m using first-child (or highly suspect anyways). How can I access JUST the “parent” UL? I’ve looked around and just can’t seem to find the answer.
Any help would be greatly appreciated
Thanks
Add the child combinator
>for matching only the immediateli: