javascript-在同一个div中编辑按钮,但有多个跨距
我正在寻找一种解决方案,每次单击按钮时将多个按钮更改为未选中状态。这是分区javascript-在同一个div中编辑按钮,但有多个跨距,javascript,html,yui,Javascript,Html,Yui,我正在寻找一种解决方案,每次单击按钮时将多个按钮更改为未选中状态。这是分区 <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"> <b
<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>
但是如果我尝试
for (i = 0; i < groupName.length; i++) {
groupName[i].set("checked", false);
}
for(i=0;i
什么也没发生
非常感谢您的帮助
谢谢 选中的不是
的有效属性。如果您想要单选按钮,请使用
并将其样式设置为按钮。查看如何执行此操作。是否选中了按钮的
?你到底想要什么?我想创建一组操作与单选按钮类似的按钮,即当选择一个按钮时,先前的取消选择按钮使用单选按钮:这就是它们的用途。如果您需要按钮“外观”,您可以将radiobutton的标签设置为类似按钮的样式,例如input[type=“radio”]+label{/*inactive styles*/}input[type=“radio”]:选中+label{/*active styles*/}
for (i = 0; i < groupName.length; i++) {
groupName[i].set("checked", false);
}