views:

416

answers:

2

I am trying to create an option transfer plugin for jQuery.

I have the basic functionality working in opera, firefox, chrome & safari but IE7 is failing to co-operate.

The transfer functions in IE7 appear to operate very sporadically and incomprehensibly.

I have created an example page to illustrate my problem.

Can anyone see where I am going wrong?

Thanks,

+1  A: 

I'm getting an error in ie:

Line: 16 Error: 'undefined' is null or not an object

That points to this:

j=l.replace(/^[\-\d\.]+/,"")

I'm guessing you need to test for null? Just a guess.

patrick dw
This doesn't seem to happen if you load the file locally. Take the source and create your own html file. I think this is a bug with jsbin?
Mike
The error is coming from the "edit.js" script, not from your code.
Pointy
+4  A: 

This doesn't look like an .appendTo()-error-in-jQuery as much as an IE7-has-superfunky-select-box-behavior problem. This workaround seems to make it behave:

.parent()
 .click(function () {     
    $selectBox1.find('option:selected')
               .appendTo($selectBox2.find('select'));
    $selectBox1.html($selectBox1.html());
    $selectBox2.html($selectBox2.html());                               
    sortBox($selectBox2); 
   })

Rebuilding the html of each select box after the appendTo() forces IE to update its state.

JSbin: http://jsbin.com/opome3/4 (fixed with .clone(true) for first button.)

jkyle
Thanks for that. It could be that I've stared at this too long but for some reason the last button (move selected from 2 -> 1) doesn't appear to work in Chrome, Firefox, Opera or Safari - in your example.
Mike
You need to add .clone(true) for the first button.
jkyle
You're a star, thanks mate.
Mike