Reputation: 47595
I do the following:
$('ul').attr('data-role','listview');
And that defaults all my unordered lists to be listviews, but I want to exclude unordered lists that are within a <nav>
tag, such as:
<nav>
<ul>
<li><a href="#">One</a></li>
<li><a href="#">Two</a></li>
</ul>
</nav>
Q: How can I change my selector to not include those unordered lists that are inside of the nav element?
Upvotes: 1
Views: 42
Reputation: 66663
You can filter out only those ul
s that are not a direct child of a nav
by doing:
$('ul').not('nav > ul').attr('data-role','listview');
Upvotes: 4