通过样式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 ...
随机推荐
- 【图像处理】【SEED-VPM】5.uImage的烧写 & NFS烧写文件系统
基于 TFTP 烧写 uImage 当用户对 SEED-VPM6467 下的内核驱动源码进行调整或者添加新的设备驱动后,需要对内核进行重新编译配置,编译生成内核镜像后,可以通过 tftp 下载到 SE ...
- Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) E. Goods transportation (非官方贪心解法)
题目链接:http://codeforces.com/contest/724/problem/E 题目大意: 有n个城市,每个城市有pi件商品,最多能出售si件商品,对于任意一队城市i,j,其中i&l ...
- Eclipse 显示所有文件
Package Explorer -> View Menu -> Filters -> uncheck .* resources http://stackoverflow.com/q ...
- Spring(3)
一.Spring容器 Spring 提供了两种类型的IOC容器(后面还会讲到AOP容器): (1)BeanFactory:IOC容器的基本实现,是Spring框架的基础设施,面向Spring的本身 ( ...
- MFC-01-Chapter01:Hello,MFC---1.3 第一个MFC程序(04)
1.3.3 框架窗口对象 MFC的CWnd类及其派生类为窗口或应用程序创建的窗口提供了面向对象的接口. CMainWindow是从CFrameWnd类派生而来,CFrameWnd模仿框架窗口的行为,可 ...
- 【转】tomcat7性能调优
注意:调优tomcat需要了解使用的tomcat是什么版本,随着tomcat版本发展有新参数引入,同时有旧参数废弃.本文档以tomcat7为例进行调优 一. 线程池(Thread Pool)优化 编辑 ...
- JS 笔记(一)
1. 页面引入 1) 标签直接引入脚本(推荐): <script type="text/javascript"> 脚本语言 </script> 2) 标签引 ...
- 基于JSON的级联列表实现
html代码: <select id="provice" onChange="setCity()"> <option value=" ...
- 利用calc计算宽度
width:calc(100% - 40px)可用 + - * / 进行计算(ie9+) 注:计算符号前后必须跟上空格.
- Cairo 下载,测试
You need to download the all-in-one bundle available here. You can discover this link yourself by vi ...