Just a suggestion, if you just need to sort the elements by id and
displaying their order without modifying the DOM you can totally do
this
alert($('#group div').add('#delta').get().sort(function(a,b) {return
a.id > b.id;}));
On Feb 18, 12:15 pm, Ricardo Tomasi wrote:
> I've since updated the
I've since updated the script by request, it failed if you began with
a single element in the container. It now sorts by any attribute you
want (ids by default) and works with multiple elements both ways.
http://ff6600.org/j/jquery.insertInOrder.js
Examples at:
http://jsbin.com/itofi
http://jsbi
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, ksunBetween you and Ricardo, I think
> I understand this now!
>
> On Dec 22, 11:42 am, ksun wrote:
> > //locate the d
Thanks to you, too, ksunBetween you and Ricardo, I think I
understand this now!
On Dec 22, 11:42 am, ksun wrote:
> //locate the div before which you want to insert and then insert,
> assuming they are ordered alphabetically
> $('div[id]').each(function(){
>
My expectation was an explanation, but many thanks for going the extra
mile, Ricardo
On Dec 22, 11:04 am, Ricardo Tomasi wrote:
> 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:
>
>
>
>
//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('');
});
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:
$('').insertInOrder('#group');
feel free to change the naming and alter the code :]
cheers,
- ricardo
On Dec 22, 3:32 pm, Tbone <95dak...@g
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 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 p
try this, it will insert gamma1 before epsilon.
$('#gamma~#epsilon').before('');
I first used after(), but that didn't work, looks like $
('#gamma~#epsilon') selects #epsilon.
On Dec 22, 10:48 am, Tbone <95dak...@gmail.com> wrote:
> I'm a relative newbie with jQuery and have read the doc about
9 matches
Mail list logo