我正在寻找一种解决方案,每次单击按钮时将多个按钮更改为未选中状态。这是div
<div id="season" align="center">
<span class="yui-button yui-radio-button yui-button-checked yui-radio-button-checked" id="season">
<span class="first-child">
<button type="button" id="season-button">Spring</button>
</span>
</span>
<span class="yui-button yui-radio-button" id="season">
<span class="first-child">
<button type="button" id="season-button">Summer</button>
</span>
</span>
<span class="yui-button yui-radio-button" id="season">
<span class="first-child">
<button type="button" id="season-button">Fall</button>
</span>
</span>
<span class="yui-button yui-radio-button" id="season">
<span class="first-child">
<button type="button" id="season-button">Winter</button>
</span>
</span>
</div>
我可以通过以下方式访问按钮:
var groupName = document.getElementById(id).getElementsByTagName("button")
但如果我尝试
for (i = 0; i < groupName.length; i++) {
groupName[i].set("checked", false);
}
什么都没发生
任何帮助是极大的赞赏!
谢谢!