[jQuery] Re: Filter doubles from selection

2007-10-25 Thread Wizzud
Umm Be very, very careful with that last modification, because if you select options in one or more of your addFrom selects without actually adding them to the target select, then select and remove something from the target select, you will probably find that the selected options in the addFr

[jQuery] Re: Filter doubles from selection

2007-10-25 Thread Korijn
Thanks alot! That did the trick for me. =) Surprisingly I had to remove tgt from the last selector in order for it to work properly though. Which confuses me. But hey it works fine. Thanks! (So this $('option:selected', tgt).remove(); became $('option:selected').remove(); ) On 25 okt, 11

[jQuery] Re: Filter doubles from selection

2007-10-25 Thread Wizzud
An alternative ... var tgt = $('select:not(.addFrom)'); $('#right').click(function(){ var x = $(tgt).children(); $('.addFrom option:selected').filter(function(){ // remove, by value, selected options already in target... return (x.filter('[value="'+this.value+'

[jQuery] Re: Filter doubles from selection

2007-10-24 Thread Korijn
And what would I do in this case? Having multiple selectboxes to choose items from? I'm not sure if using prefixes in the valuables is a good idea to keep track of what item came from what selectbox but it's all I can come up with right now. //

[jQuery] Re: Filter doubles from selection

2007-10-24 Thread Korijn
Because I have multiple selectboxes to choose options from (there are different kinds of items you can add to the selection). On Oct 24, 12:21 am, Wizzud <[EMAIL PROTECTED]> wrote: > Why clone()? Why not just move them from one to the other? > > (ids changed for simpler coding...) > > test 1 >

[jQuery] Re: Filter doubles from selection

2007-10-23 Thread Wizzud
Why clone()? Why not just move them from one to the other? (ids changed for simpler coding...) test 1 test 2 test 3 >> << $('button').each(function(){ var lr = this.id.split('_'); $(this).click(function(){ $('#' + lr[0] + ' option:selected').appendTo('#' + lr[