Use prop as seen here: .prop() vs .attr()$itemVariantRowRadio.prop('checked', true);如果在jQuery中< 1.6:If in jQuery < 1.6:$itemVariantRowRadio.attr('checked', true);也:ALSO:尝试像这样创建您的元素:Try creating your element like so:var $itemVariantRowRadio = $("<input/>",{ type: 'radio', name: 'itemvariant', class: 'itemvariant', checked: true, value: 'whatever'});$itemVariantRow.append($itemVariantRowRadio);请参阅小提琴: http://jsfiddle.net/maniator/6CDf3/带有2个输入的示例: http://jsfiddle.net/maniator/6CDf3/2/See fiddle: http://jsfiddle.net/maniator/6CDf3/An example with 2 inputs appended: http://jsfiddle.net/maniator/6CDf3/2/ 这篇关于单选按钮和.attr('checked','checked')在IE7中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-27 05:29