更新时间:2023-08-22 21:40:34
尝试
.removeAttr("checked")
As the title says, I can't get .attr('checked', false)
to work on IE6. I am cloning some HTML and then before I assign the newly cloned HTML to a element, I run through it and un-check all of the checkboxes that are in the newly cloned section, which works fine in all browsers except IE 6.
Here is the code:
//give each input and select a custom id
clone.find('input, select').each( function( i ) {
//get the id attribute
var id = $(this).attr('id');
//uncheck all of the tick boxes
$(this).attr('checked', '');
//get the name attribute
var name = $(this).attr('name');
$(this).attr('name', name+"_"+count)
$(this).attr('id', id+"_"+count+"_"+i)
});
//append the newly created area to the area wrapper
clone.appendTo('[data-custom="area_wrapper"]');
Is there any way that I can work around this problem?
Try
.removeAttr("checked")