IE7 radio button issue when created dynamically

I have an issue in IE7 when I am creating clones of radio buttons. I am dynamically updating the name and ID attributes, however, I still have the issue that a radio button being checked resets any of the others which have been created dynamically. Any idea how this can fixed? Here is a fiddle of the issue

This is the JS code which manipulates the form fields:

// Dropdown select
$('#quantity').live("change", function(){


    // 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;

             // Store previous number for replacing with current in cloned block input fields
                var prev = i-1;

                // Update input name to make it unique
                new_block.find('input').each(function() {
           =, i);
           = + i;

            // Bit of a workaround needed to clone properly, reiterating class name
            $('.multiple_questions_container').append('<span class="questions_clonable hidden">'+new_block.html()+'</span>');



It seems your question was answered on StackOverflow already:

As the first person to answer points out, it seems IE7 won’t let you rename the radio buttons’ name attribute.

Yes, I found the following solution after trying out a few different suggestions.

function setElementName(elems, name) {
        if ($.browser.msie === true){
            $(elems).each(function() {
                this.mergeAttributes(document.createElement("<input name='" + name + "'/>"), false);
        } else {
            $(elems).attr('name', name);