I think all I need is a selector, but can’t find one. I want to select the anchor tag, but can only select the li using .parent()…
jQuery:
$("nav ul li > ul").parent().append('<span class="arrow">↓</span>');
HTML:
<li><a href="#">The Events</a>
<ul>
<li><a href="#">Schedule</a></li>
<li><a href="#">Buy Tickets</a></li>
<li><a href="#">Features</a></li>
</ul>
</li>
The code above puts the arrow on the right lis, but one level to high. I need to target the li‘s a tag.
You can use
.siblings(), like this:You can find a full list of traversal functions here.