多个全选,发送到后台,与后台操作

1.多个全选,发往后台
JS代码

 1 $('.bAll').change(function(){
 2            $(this).parent().parent().parent().parent().parent().parent().find(':checkbox[b]').prop('checked',$(this).is(':checked')?true:false);
 3         });
 4 $('.fAll').change(function(){
 5            $(this).parent().parent().parent().parent().parent().parent().find(':checkbox[f]').prop('checked',$(this).is(':checked')?true:false);
 6         });
 7 $(":checkbox").change(tongJi);
 8     function tongJi() {
 9         var feeCollect="";
10         var feeSvc="";
11         $(":checkbox:checked[b]").each(function(e){
12             feeCollect+=($(this).attr("flag")+",");
13             
14         });
15         $(":checkbox:checked[f]").each(function(e){
16             feeSvc+=($(this).attr("flag")+",");
17             
18         });
19         feeCollect = feeCollect.substring(0, feeCollect.lastIndexOf(','));
20         feeSvc = feeSvc.substring(0, feeSvc.lastIndexOf(','));
21         $("#f").val(feeSvc);
22         $("#b").val(feeCollect);
23     }

 2.HTML代码

 1  <div class="box box-solid">
 2      <div class="box-header with-border" >
 3           <h3 class="box-title">
 4              供应商信息
 5          </h3>
 6          <div class="box-tools pull-right"></div>
 7      </div>
 8     <c:forEach items="${srModel.list}" var="item" varStatus="s">
 9      <div class="box-body">
10        <div class="form-group ">
11         <div class="box-header with-border" >
12           <h4 class="box-title">
13             
14                 ${item.bidPackage.packageName }${item.bidPackage.packageCode }
15             
16          </h4>
17          <div class="box-tools pull-right"></div>
18              </div>
19             
20             <div>
21             <table  class="table table-hover table-striped"
22                     border="0" cellspacing="0" cellpadding="0" role="grid" rules="cols">
23             <thead>
24             <tr>
25             <th>
26             供应商名称
27             </th>
28             <th>
30             标书费<input type="checkbox" class="bAll">
31             
32             </th>
33             <th>
34             保证金<input type="checkbox" class="fAll">
35             </th>
37             </tr>
38             </thead>
39                 <c:forEach items="${item.list }" var="com"  varStatus="i">
40                 <tr>
41                 <td>${com.company.companyName }</td>
42                 <td><input class="valid"  type="checkbox" b flag="${com.id }" <c:if test="${com.feeCollect=='1' }" > checked </c:if> ></td>
46                 <td>
47                 <input class="valid" type="checkbox" f flag="${com.id }" <c:if test="${com.feeSvc=='1' }" > checked </c:if> >
48                 </td>
49                 </tr>
50                 </c:forEach>
52             </table>
53             </div>
54         </div>
55     </div>
56     </c:forEach>
57 </div>
1 <input type="hidden" id="f" name="v(baoZhengJin)"><!--保证金 -->
2 <input type="hidden" id="b" name="v(biaoShu)"><!-- 标书费 -->

猜你喜欢

转载自www.cnblogs.com/zhanglixuan/p/10216509.html