[thelist] Sort DIV

Nik Schramm n at industriality.com
Fri Nov 8 09:50:10 CST 2002


On 08.Nov.02 15:42 Stevenson Ngila wrote

 > is there a way i can sort this divs by names alphabetically!

Yes, *but* only using JavaScript/DOM, so it will only work in IE and
Mozilla/NN6+ and then only if the user has JS switched on. Still, better
than nothing...

Try this: http://dev.nae.de/dom-sorting/

Note how the second example shows how alphabetical sorting using
array.sort() in JS is unable to mix the results for both lower- and
upper-case strings within the same sort. If this is important to you,
you have to write your own custom sort handler and use
array.sort(sortFunction) instead. There are numerous examples of how to
do that around the web.

--
/nik




More information about the thelist mailing list