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提交

最新文章

  1. Redis学习笔记~目录
  2. MySQL中如何插入反斜杠,反斜杠被吃掉,反斜杠转义
  3. Python Socket,How to Create Socket Server? - 网络编程实例
  4. HTML之学习笔记(十)表单元素
  5. C#中的DataTable简单使用Merge
  6. ajax——client访问webservice基本用法
  7. JS组件系列——自己动手扩展BootstrapTable的treegrid功能
  8. Node.js Buffer
  9. Spring Cloud分布式微服务系统中利用redssion实现分布式锁
  10. C#实现多个PDF合并及去除文字水印功能
  11. 全网最详细的最新稳定OSSEC搭建部署(ossec-server(CentOS7.X)和ossec-agent(CentOS7.X))(图文详解)
  12. MS-DOS 6.22 +Vim+masm 汇编环境
  13. Excel:11个查询函数组合
  14. C++ GetComputerName()
  15. Go语言之闭包
  16. 安装OpenResty开发环境
  17. eclipse集成tomcat日志文件输出配置
  18. AangularJS入门总结二
  19. VS 代码整理插件推荐:CodeMaid
  20. EventHandler 与常见的.Net预定义委托

热门文章

  1. 关于RequireJS与AngularJS的集成文档
  2. Get Script Path in Shell
  3. 在Spring tools suite中使用git 共享项目
  4. 在eclipse的maven插件中搜寻本地仓库中的jar搜索不到的解决方案
  5. c++ redis-client
  6. 启动Mysql服务提示Can’t connect to local MySQL server through socket的解决方法
  7. PHP 关于SQL注入的防范措施。
  8. 对vector&lt;int&gt;进行快速排序
  9. 麦咖啡阻挡正常打开Excel文件
  10. C#中Invoke的用法(转)