I wrote a simple plug-in that will insert elements in alphabetical order (by id) for you: http://ff6600.org/j/jquery.insertInOrder.js
Use it like: <div id="group"> <div id="alpha"></div> <div id="beta"></div> <div id="gamma"></div> <div id="epsilon"></div> </div> $('<div id="delta"/>').insertInOrder('#group'); feel free to change the naming and alter the code :] cheers, - ricardo On Dec 22, 3:32 pm, Tbone <95dak...@gmail.com> wrote: > Great! Thanks... > However, I'm more clueless than I should be...and didn't pose the > complete question... > > I have the divs as shown above, how do I locate where <div > id="delta"></div> would go? > Obviously between gamma and epsilon, but I need to search the ids for > the first (id > "delta"). Then I can use your insert to properly > place it. I assume I use a selector, but am not sure how to put it > together. > > On Dec 22, 10:25 am, ksun <kavi.sunda...@gmail.com> wrote: > > > try this, it will insert gamma1 before epsilon. > > > $('#gamma~#epsilon').before('<div id="gamma1"/>'); > > > I first used after(), but that didn't work, looks like $ > > ('#gamma~#epsilon') selects #epsilon.