jQuery bug? .appendTo() not working in IE7
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 proble开发者_开发百科m.
Can anyone see where I am going wrong?
Thanks,
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.)
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.
精彩评论