1

现在,在您开始告诉我不支持 IE6 之前,请知道这不是我的决定,而且我被遗留系统所困,迫使我降级到 ie6,并在可能的情况下降级到 ie8……我什至无法在 FF 或 Chrome 上交付,悲伤的日子!

我的问题来自特定机器设置(通过 Citrix 元框架的 IE6)无法克隆元素的事实。

例如:

//clone the elements
var oldProd = $(this).parents('.wdm-ui-prodHierarchy-fieldset');
var newProd = $(this).parents('.wdm-ui-prodHierarchy-fieldset').clone(false);

//Change the ids in the cloned items
prodStructSequence++;
$('#console').append('<p>old prod number: ' + oldProd.attr('number') + '</p>');
newProd.attr('number', prodStructSequence);
$('#console').append('<p>old prod number: ' + oldProd.attr('number') + '</p>');
$('#console').append('<p>new prod number: ' + newProd.attr('number') + '</p>');
newProd.find('select.prod-struct-service').each(function(i){ this.id = increment(this.id, prodStructSequence); } );
newProd.find('select.prod-struct-product').each(function(i){ this.id = increment(this.id, prodStructSequence); } );
newProd.find('select.prod-struct-action').each(function(i){ this.id = increment(this.id, prodStructSequence); } );
newProd.find('.cloneButton').each(function(i){ this.number = increment(this.number, prodStructSequence); } );
newProd.find('.removeButton').each(function(i){ this.number = increment(this.number, prodStructSequence); } );

我也尝试直接使用:

newProd.number = prodStructSequence;

但我的结果总是这样:

old prod number: 1
old prod number: 2
new prod number: 2
Found element.number: 2
Found element.number: 2

您有解决方案吗,也许不使用克隆,我只是希望它可以继续进行其他操作。

版本:

  1. IE6.0.3790.3959 + Citrix + jQuery 1.10.2 不起作用
  2. IE6.0.2900.5512 + Windows Xp Mode SP3 + jQuery 1.10.2 工作
  3. IE8、FF、Chrome 都可以
4

2 回答 2

0

我没有太多经验,clone()但可能有不同的方法来实现这一点:

$(this).parents('.wdm-ui-prodHierarchy-fieldset').wrap('<span class="save_me_for_later" />');

var newProd = $('.save_me_for_later').html();

$('.save_me_for_later').remove();
于 2013-10-02T20:29:30.590 回答
0

我最终重写了大部分代码,因为没有任何效果。最终结果是我预先生成了 X 行而不是克隆并显示/隐藏字段组/行,并按需重置它们。

谢谢大家的建议

于 2013-10-03T17:06:20.220 回答