Multiple checkboxes selected and deleted

Source: Internet
Author: User

//多个如何传输数据function deleteUser() {          //当时是想把内容以str+=""的方式 进行保存 ,但不行           //var str;          var array = new Array(); //用于保存 选中的那一条数据的ID           var flag; //判断是否一个未选           $("input[name=‘selectFlag‘]:checkbox").each(function() { //遍历所有的name为selectFlag的 checkbox                      if ($(this).attr("checked")) { //判断是否选中                            flag = true; //只要有一个被选择 设置为 true                      }                  })          if (flag) {              $("input[name=‘selectFlag‘]:checkbox").each(function() { //遍历所有的name为selectFlag的 checkbox                          if ($(this).attr("checked")) { //判断是否选中                                //alert($(this).val());                              array.push($(this).val()); //将选中的值 添加到 array中                              //str+=$(this).val()+",";                          }                      })              //将要集体删除的数据 传递给action处理               window.self.location = "deleteUser?info=" + array;          } else {              alert("请至少选择一个用户");          }      }
//多个如何进行DOM树操作<script>$(function(){$(‘:checkbox[name=all]‘).click(function(){if(this.checked){$(‘:checkbox‘).attr(‘checked‘,‘checked‘);}else{$(‘:checkbox‘).removeAttr(‘checked‘);}})$(‘button‘).click(function(){                                                                  var num = 0;$(‘:checkbox[name=child]‘).each(function(){if($(this).attr(‘checked‘)){$(this).closest(‘tr‘).remove();num++;}})alert(‘共删除了【‘+num+‘】行‘);})})</script>


Multiple checkboxes selected and deleted

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.