I ended up rewriting most of the code cause nothing worked. The end result is that i pre-generated X number of lines instead of cloning and show/hide the group/line of fields and just reset them on demand.
Thank you all for your suggestions
Frage
Now before you start telling me not to support IE6, just know it's not my decision and i'm stuck with a legacy system forcing me downwards to ie6 and when possible to ie8... I can't even deliver on FF or Chrome, sad days!
My problem comes from the fact that a specific machine setup (IE6 via a Citrix metaframe) is unable to clone elements.
For example:
//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); } );
I also tried directly using:
newProd.number = prodStructSequence;
But my result is always this:
old prod number: 1
old prod number: 2
new prod number: 2
Found element.number: 2
Found element.number: 2
Do you have a solution, maybe not using clone, i just want this to work to move on to something else.
Versions:
Lösung 2
I ended up rewriting most of the code cause nothing worked. The end result is that i pre-generated X number of lines instead of cloning and show/hide the group/line of fields and just reset them on demand.
Thank you all for your suggestions
Andere Tipps
I do not have much experience with clone()
but there might be a different way to accomplish this:
$(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();