Sort Element Array by DOM Position


/ Published in: JavaScript
Save to your folder(s)

This function will sort an array of DOM elements in order of the DOM position. Useful when using calls such as $$("img.L,img.M") which doesn;t return a sorted element array.

It uses prototype but you can replace the Prototype.Browser stuff with anything else.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.