would like to select all list elements that do not have a nested list under them (could be in any order, so next necessary the first or last).
In the case below it would be the one that reads:
<li>Main Item Three</li>
I'm able to select those list elements that do have a nested list:
$('ul.location_list li:has(ul)')
Figured I could use something like:
$('ul.location_list li:not(ul)')
But no dice. Thoughts?
<li>Main Item Three</li>
<ul class="location_list">
<li>Main Item One
<ul>
<li>Sub-Item One A</li>
<li>Sub-Item One B</li>
<li>Sub-Item One B</li>
</ul>
</li>
<li>Main Item Two
<ul>
<li>Sub-Item Two A</li>
<li>Sub-Item Two B</li>
<li>Sub-Item Two B</li>
</ul>
</li>
<li>Main Item Three</li>
</ul>
$('ul.location_list>li:not(:has(ul))')
(untested :)