I want to use jQuery to add a number to the end of a navigation menu list item. This is the number of products on another page. Currently a single list item looks something like this:
<li class="ui-accordion ui-widget ui-helper-reset" role="tablist">
<a title="New In" href="http://example.com/shop/clothing/new-in">New In</a>
</li>
However I want to add the number of items directly after 'New' for example 'New (20)'. This number is located on items href, in the following place on that page:
<div class="paging">
<span class="itemcount">174</span>
</div>
Each list item has a different href but the same class which contains the unique number that I need. Any ideas?
I have tried:
$("#ui-id-12 > .ui-accordion > li:eq(0) > a:eq(0)").replaceWith('<a title="New In" href="http://example.com/shop/clothing/new-in">New In ' + $(this).load("http://m.example.com/shop/clothing/new-in.html .itemcount") + '</a>');