I thought you wanted to insert the new element in order according to the *Greek* alphabet. That will take a bit of extra work.
-Mike > From: Tbone > > Thanks to you, too, ksun....Between you and Ricardo, I think > I understand this now! > > On Dec 22, 11:42 am, ksun <kavi.sunda...@gmail.com> wrote: > > //locate the div before which you want to insert and then insert, > > assuming they are ordered alphabetically > > $('div[id]').each(function(){ > > if ($(this).attr('id') > 'delta') > > $(this).before('<div > > id="delta"/>'); > > }); > > > > I think there is no selector that will do the same, but I may be > > wrong. > > On Dec 22, 12: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.- Hide quoted text - > > > > > - Show quoted text - >