I THINK I figured this one out.  I was creating the new select box dynamically 
by cloning the former, like so:

var unselected = selected.clone(true);
unselected.attr('name', 'unselected_' + unselected.attr('name'));

For whatever reason, when I did that IE wasn't removing elements from the new 
select box properly, and was having bizarre redraw issues when it did remove 
them.

When I skipped that and went for the Old Skool(TM) method, everything suddenly 
started working:

var unselected = document.createElement('select');
var selectedOptions = jQuery('option', selected);
selectedOptions.each(function() {
  //console.debug(this);
  if (! this.selected) {
    unselected.options[unselected.options.length] = new Option(this.text, 
this.value, false, false);
    jQuery(this).remove();
  }
});
unselected = jQuery(unselected);
unselected.attr('name', 'unselected_' + 
unselected.attr('name')).attr('multiple', 'multiple');

So it actually had nothing to do with the original code to shift elements from 
one to the other.  The dynamic select box was corrupted in IE from the get-go.

I don't know if there's a bug report in here or not.  I leave that to people 
with more intimate knowledge of the system to decide.  I'm using 1.1.2. :-)

Thanks to everyone who replied!

--Larry Garfield

On Fri, 13 Apr 2007 15:43:45 -0500, Larry Garfield <[EMAIL PROTECTED]> wrote:
> 
> 
> I'll have a look at the code there, thanks.  I think I have narrowed down
> the cause of the problem, though.  IE *really* doesn't like that I'm
> adding a select box to the page dynamically, and is therefore pouting by
> refusing to redraw it.
> 
> As the wiki says, IE is a sadist. :-(
> 
> --Larry Garfield
> 
> On Fri, 13 Apr 2007 16:35:12 -0300, "Leonardo K" <[EMAIL PROTECTED]> wrote:
>> Check this out: http://200.169.53.89:8080/WebApplication/Test/teste.html
>>
>> I'm using the plugin jquery.select.js from
>> http://www.texotela.co.uk/code/jquery/select/, but I modified some lines
>> of
>> the code.
>>
>>
>> On 4/13/07, Larry Garfield <[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>
>>> Thanks Karl!  I'm afraid that's not working either.  I'm actually
>>> manipulating a multi-value select box, not single value.  That's where
>> the
>>> redraw problem is happening.
>>>
>>> Current snapshot of what I'm doing is here:
>>>
>>> http://www.garfieldtech.com/jsdemo/pullbox/test1.html
>>>
>>> The behavior in Firefox is almost exactly what I want.  The behavior in
>> IE
>>> is all kindsa broken.
>>>
>>> Any suggestions?
>>>
>>> --Larry Garfield
>>>
>>> On Fri, 13 Apr 2007 12:46:51 -0400, Karl Swedberg
>> <[EMAIL PROTECTED]>
>>> wrote:
>>> >
>>> > On Apr 13, 2007, at 12:22 PM, Larry Garfield wrote:
>>> >> Not yet.  Honestly, I kept having problems with the :selected style
>>> >> syntax.  It never matched elements for me.  That's why I switched
>>> >> to using [EMAIL PROTECTED], which someone in #jQuery suggested (I don't
>>> >> recall who).  I'll give that a try this afternoon and see if it
>>> >> works. :-)
>>> >
>>> > sounds good.
>>> >
>>> > I had a few minutes during lunch, so I put together a little test
>>> > page, and it worked just fine in IE6:
>>> >
>>> >       http://test.learningjquery.com/selects.htm
>>> >
>>> > I bound it to the onchange event, so my code looks like this:
>>> >
>>> > $(document).ready(function() {
>>> >    $('#selectbox_from').change(function() {
>>> >      $('#selectbox_from
>> :selected').remove().appendTo('#selectbox_to');
>>> >    });
>>> > });
>>> >
>>> >
>>> >
>>> > --Karl
>>> > _________________
>>> > Karl Swedberg
>>> > www.englishrules.com
>>> > www.learningjquery.com

Reply via email to