i have the following html
<li class="cat-item cat-item-3 collapsable">
<div class="someclass"></div>
<a href="http://demo.mysite.com/category/parent-category-i/" title="View all posts filed under Parent Category I">
Parent Category I
</a>
<ul class="children">
<li class="cat-item cat-item-6">
<a class="" href="http://demo.mysite.com/category/parent-category-i/child-category-i/" title="View all posts filed under Child Category I">
Child Category I
</a>
</li>
<li class="parent cat-item cat-item-7 collapsable lastCollapsable">
<div class="someclass"></div>
<a href="http://demo.mysite.com/category/parent-category-i/child-category-ii/" title="View all posts filed under Child Category II">
Child Category II
</a>
<ul class="children">
<li class="cat-item cat-item-9 last">
<a href="http://demo.mysite.com/category/parent-category-i/child-category-ii/grandchild-category-i/" title="View all posts filed under Grandchild Category I">
Grandchild Category I
</a>
</li>
using the above html and jquery, how it is possible to add a
<span class="folder">
after every li.parent class and after every parents anchor tag. so finally above html will look like
<li class="cat-item cat-item-3 collapsable">
<div class="someclass"></div>
<a href="http://demo.mysite.com/category/parent-category-i/" title="View all posts filed under Parent Category I">
Parent Category I
</a>
<ul class="children">
<li class="cat-item cat-item-6">
<a class="" href="http://demo.mysite.com/category/parent-category-i/child-category-i/" title="View all posts filed under Child Category I">
Child Category I
</a>
</li>
<li class="parent cat-item cat-item-7 collapsable lastCollapsable">
<span class="folder"> // <-------------------- Want this
<div class="someclass"></div>
<a href="http://demo.mysite.com/category/parent-category-i/child-category-ii/" title="View all posts filed under Child Category II">
Child Category II
</a>
</span> // <------------------------ Closing span of what I Want
<ul class="children">
<li class="cat-item cat-item-9 last">
<a href="http://demo.mysite.com/category/parent-category-i/child-category-ii/grandchild-category-i/" title="View all posts filed under Grandchild Category I">
Grandchild Category I
</a>
</li>
this means to append a span class to each parent class of a li and closing span in the end