期末评教
失败版
for (var i of document.querySelectorAll('.ant-form-item-control')) {
var group = i.querySelector('.ant-radio-group');
if (group) {
i.className = 'ant-form-item-control has-success';
var label = group.querySelectorAll('.ant-radio-wrapper')[0];
if (label) {
label.className = 'ant-radio-wrapper ant-radio-wrapper-checked';
var radio = label.querySelector('input');
if (radio) {
radio.checked = true;
// 触发 change 事件
var event = new Event('change', {
'bubbles': true
});
radio.dispatchEvent(event);
}
}
}
}
千问的帮助下:
for (var i of document.querySelectorAll('.ant-radio-group')) {
var radio = i.childNodes[0].querySelector('input');
radio.click();
var event = new Event('change', {
'bubbles': true
});
radio.dispatchEvent(event);
}