On one page of my site I have have a list of entries created by the user - standard HTML <ul>
with <li>
elements inside it.
I want to iterate through the list, but the order of elements is important.
Using jQuery $('.myList li').each()
, can I guarantee that I will get the li
elements in the order that they appear in the DOM?
From my tests so far, it appears that they do get iterated in the correct order, but I can't find anything that tells me it's guaranteed.
If it isn't guaranteed, what would be the next best alternative method for iterating through them in order?