...

View Full Version : IE7 radio button issue when created dynamically



nicky77
11-28-2012, 04:55 PM
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 (http://jsfiddle.net/w9UJ8/)

This is the JS code which manipulates the form fields:


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

$('.questions_clonable:not(.questions_clonable: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;

// 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() {
this.name = this.name.replace(prev, i);
this.id = this.id + 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>');

}
}
});​



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum