I have a WordPress menu structured like this:
<div id="my_custom_class">
<ul class="my_custom_class">
<li class="page_item"><a href="#">page_item</a>
<ul class='children'>
<li class="page_item child"><a href="#">children</a></li>
</ul>
</li>
<li class="current_page_item"><a href="#">current_page</a></li>
<li class="current_page_item"><a href="#">current_page</a></li>
<li class="current_page_item"><a href="#">current_page</a></li>
</ul>
</div>
This menu is generated using:
<? wp_nav_menu('menu=header'); ?>
I want to add a <span></span>
tag before the anchor tag in any li
that has children, like this:
<div id="my_custom_class">
<ul class="my_custom_class">
<li class="page_item"><span></span><a href="#">page_item</a>
<ul class='sub-menu'>
<li class="page_item child"><a href="#">children</a></li>
</ul>
</li>
<li class="current_page_item"><a href="#">current_page</a></li>
<li class="current_page_item"><a href="#">current_page</a></li>
<li class="current_page_item"><a href="#">current_page</a></li>
</ul>
</div>
How can I achieve this using jQuery?