【发布时间】:2018-06-05 07:45:30
【问题描述】:
所以我的问题是,我将如何计算已选中的复选框以及答案为“是”的单选按钮...我现在用于单选按钮的代码是:
<label class="radio-inline">
<input form="ES3S" type="radio" name="Textbook'.$i.'" value="'.$Result[$i]['ID'].'"> Yes
</label>
<label class="radio-inline">
<input form="ES3S" type="radio" name="Textbook'.$i.'" value="-1">No
</label>
<span class="d-inline-block" data-toggle="popover" title="Error" data-content="This book is required by the school. If you want to cancel this out, proceed to the principals office with the book for review." data-trigger="hover">
<input form="ES3S" required checked onclick="return false;" type="checkbox" value="'.$Result[$i]['ID'].'" name="Textbook'.$i.'">
</span>
我正在考虑有一个计时器,它每秒检查一次以检查有多少复选框和单选按钮被选中,但我认为这是非常不切实际的。
SetInterval(ScriptUpdate, 1000);
function ScriptUpdate(param){
var check = $('#form').find('input[type=checkbox]:checked').length;
alert('You have checked forms');
return false;
}): }
干杯!提前致谢
【问题讨论】:
-
到目前为止你尝试了什么?
-
好吧,老实说,我不知道如何制作单选按钮,但是使用复选框... ^ 我在 :) 中编辑了它们
-
既然您已经知道如何获取复选框计数,或许可以专门针对单选按钮更新您的问题?
-
你不想按计时器来做。你想数到什么时候?也许您可以使用(自定义)事件来做到这一点。
标签: jquery html radio-button