jQuery bug? .appendTo()在IE7中不起作用 [英] jQuery bug? .appendTo() not working in IE7
问题描述
我正在尝试为jQuery创建一个选项传输插件。
I am trying to create an option transfer plugin for jQuery.
我的基本功能是在opera,firefox,chrome& safari但IE7未能合作。
I have the basic functionality working in opera, firefox, chrome & safari but IE7 is failing to co-operate.
IE7中的传输功能似乎非常零星且难以理解。
The transfer functions in IE7 appear to operate very sporadically and incomprehensibly.
我创建了示例页面来说明我的问题。
任何人都可以看到我出错的地方吗?
Can anyone see where I am going wrong?
谢谢,
推荐答案
这看起来不像.appendTo() - jQuery中的错误和IE7-has-superfunky-select-box-behavior一样多问题。此解决方法似乎使其行为:
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);
})
在appendTo()强制IE更新其状态后重建每个选择框的html。
Rebuilding the html of each select box after the appendTo() forces IE to update its state.
JSbin: http://jsbin.com/opome3/4 (第一个按钮用.clone(true)修复。)
JSbin: http://jsbin.com/opome3/4 (fixed with .clone(true) for first button.)
这篇关于jQuery bug? .appendTo()在IE7中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!