通过样式class 判断多个checkbox redio 是否都选中
var count = "${count}";
for(var i=1;i<=count;i++){
var flag = false;
if($("input[class='optionId"+i+"']:checked").length > 0){
flag = true;
}
if(flag==false){
alert("第 "+i+" 题未作答,请选择答案!");
return false;
}
}
<c:forEach items="${list}" var="risk" varStatus="status">
<div class="pg_item">
<div class="pgt_bt">
${status.index+1}、<input type="text" name="title"
value="${risk.title }" /> <input type="hidden" name="stemId"
value="${risk.id }" /> <input type="hidden" name="type"
value="${risk.type }" />
</div>
<c:forEach items="${risk.option}" var="option" varStatus="optionStatus">
<label class="pgt_list">
<c:if test="${risk.type == 1}">
<input type="radio" name="optionId${status.index}" class="optionId${status.index+1}" value="${option.id}">${option.content}
</c:if>
<c:if test="${risk.type == 2}">
<input type="checkbox" name="optionId${status.index}" class="optionId${status.index+1}" value="${option.id}">${option.content}
</c:if>
</label>
</c:forEach>
</div>
</c:forEach>
通过class判断 form提交时是通过 name提交
通过样式class 判断多个checkbox redio 是否都选中的更多相关文章
- 判断一组checkbox/redio是否被选中,为其添加样式
业务场景:当一行中有一个CheckBox被选中,则为此行添加class. <script type="text/javascript"> $(function(){ $ ...
- 《jQuery判断radio、checkbox、select 是否选中和设置选中问题以及获取选中值》总结
<form> <input type="radio" name="gender" id="man" value=" ...
- Datagridview 添加checkbox列,并判断Datagridview 中的checkbox列是否被选中
Solution1://In Fill DataGridViewEvent : DataGridViewCheckBoxColumn ChCol = new DataGridViewCheckBoxC ...
- jQuery操作复选框checkbox技巧总结 ---- 设置选中、取消选中、获取被选中的值、判断是否选中等
转载:https://blog.csdn.net/chenchunlin526/article/details/77448168 jQuery操作复选框checkbox技巧总结 --- 设置选中.取消 ...
- 前端开发学习之——使用jquery/javascript判断及改变checkbox选中状态
一.使用jquery判断及改变checkbox选中状态 1.使用JQuery判断一个checkbox 是否为选中: (1).attr('checked) 看JQuery版本1.6+返回:”checke ...
- jsp <input type="checkbox" name="fileId"> 是否选中
jsp <input type="checkbox" name="fileId"> 是否选中 var a = document.getElement ...
- 【TP3.2+onethink】radio+checkbox+select 空间 编辑页面选中,附录 js 返回上一页
1.TP3.2框架 如何实现 [radio+checkbox+select 空间 编辑页面选中],说实话,比较繁琐,不咋地!! 不废话,上代码:(其中 XX_arr 变量一维数组) <div ...
- js判断radio,checkbox是否选中
从数据库循环数据,多选按钮数组 function type_1(){ //多选 var b= document.getElementsByName('service_zj_ids[]'); var ...
- jQuery判断checkbox是否选中?操作checkbox(不)选中?
HTML <form action=""> <input type="checkbox" name="c ...
随机推荐
- 小游戏Item表
[Config]1|0|我|1|10|500|0|8|2|4|b5222d10-55a7-4789-8541-8e7430345d54|0|0[Config] [Config]2|1|公主|1|0|5 ...
- jstl_fmt
<fmt:formatDate value="${isoDate}" type="both"/>2004-5-31 23:59:59<fmt: ...
- [SHTSC 2014] 信号增幅仪
最小覆盖圆算法.看着题解半蒙半抄的搞过去了… 主要参考以下http://blog.csdn.net/acdreamers/article/details/9406735http://blog.csdn ...
- 如何解决前端传来的时间格式与mysql表中时间格式不匹配的查询问题
前端传过来的时间格式为“2016-07-11 11:13:10”,而数据表中对应字段`add_time`的格式为“2016-7-11”,此时sql不能直接用 "where `add_time ...
- useful tips for win7--close the noise volume(关掉win7开机、系统操作的声音)
how to close the voice of your PC? i) open your computer and then press F2 to enter the BIOS set-u ...
- [转]ZendFramework数据库操作总结
Zend_Db数据库知识 例子: Model文件: $this->fetchAll("is_jian=1","id DESC",0,2)->toAr ...
- CGContext 解释
Managing Graphics Contexts:管理图形上下文 CGContextFlush // 强制立即渲染未执行在一个窗口上下文上的绘图操作到目标设备.系统会在合适的时机自动调用此函数,手 ...
- AngularJs的UI组件ui-Bootstrap分享(七)——Buttons和Dropdown
在ui-Bootstrap中,Buttons控件和Dropdown控件与form表单中的按钮和下拉框名字很像,但实际上这两个控件有新的含义. 先说Buttons,它是一组按钮,用来实现form表单中的 ...
- flexbox实现不等宽不等高的瀑布流布局
第一次做不等宽不等高的瀑布流布局,刚开始企图用ccs3的column属性+flexbox来实现,瞎捣鼓半天都没有能弄好, 弱鸡哭晕在厕所(┬_┬),气的午饭都没有吃. 后来逼着自己冷静下来,又捣鼓了1 ...
- ubuntu 安装MTK 移动终端usb驱动
lsusbBus 001 Device 002: ID 8087:8000 Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation ...