Hey,
I have a nested list like this:
<ul class="list">
<li class="list_item_type_1">
nested list
<ul class="list">
<li class="list_item_type_2">Unnested item</li>
</ul>
</li>
<li class="list_item_type_2">Unnested item</li>
</ul>
With jQuery I want to add a listitem before all ".list _ item _ type _ 2" in the first ".list". I write it like this:
$('.list:first').find('LI.list_item_type_2:first').before('<li class="list_item_type_1">Nested list (...)</li>');
This won't work as intended because the script finds the first ".list _ item _ type _ 2" in the second ".list" and appends the new code there instead.
How can I keep the search in the first UL and prevent it from entering underlying UL-elements?
Cheers!