1
Have to count the elements that are inside the li, but let it be by step, for example first take the li1 and count the elements that in the case have to go back 3 and then pass to another li.
<ul>
<li id='li1'>
<a>elemento 1</a>
<a>elemento 2</a>
<a>elemento 3</a>
</li>
<li id='li2'>
<a>elemento 1</a>
<a>elemento 2</a>
<a>elemento 3</a>
</li>
</ul>
An Array that contains objects {id: <id of the li> tag, counter: <counter of li>} elements would suit you? With it you could implement an iterator to compose whatever computation you want. And this? It really needs Jquery?
– Miguel Fontes