Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript-在同一个div中编辑按钮,但有多个跨距_Javascript_Html_Yui - Fatal编程技术网

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);
    }