Select next element in the page source using jQuery
- by Travis
I have an arbitrarily deep list of the form:
<ul>
<li></li>
<li>
<ul>
<li></li>
</ul>
</li>
</ul>
I am trying to build a function "nextElement" that returns a jQuery selector.
The first time the function is called, it returns the first li in the list. The second time it is called, it returns the next li in the page. Etc.
I'd like this function to pay no attention to siblings, parents, children, etc. All I care about is that everytime it is called, the next li in the source gets chosen.
Any suggestions on how to go about approaching this?
Thanks