I’ve together a fiddle example of how I’m trying to clone elements according to a dropdown value selection, however it doesn’t work in IE7 and 8 (shows “null” instead of the cloned element). Can anyone see how to correct this? Many thanks. The JS code is as follows:
// Dropdown select
$('#quantity').live("change", function(){
$('.questions_clonable:not(:first)').remove();
// Get value of selection
var num = $(this).val();
var cloned_el = $('.questions_clonable').clone();
if (num > 1)
{
for (var i = 1; i < num; i++)
{
// Assign cloned block to new var
var new_block = cloned_el;
// Bit of a workaround needed to clone properly, reiterating class name
$('.multiple_questions_container').append('<span class="questions_clonable hidden">'+new_block.html()+'</span>');
}
}
});
IE does not support the CSS :not selector so to get it done
change this
to
DEMO