首页 > 代码库 > 根据样式获取被选中的checkbox

根据样式获取被选中的checkbox

<ul id="PhotoMainUL_Create" toolbar="#toolbarAttachment">
  <li style="width:80px;"><input class="v_list_chek" style="text-align:left;" value=http://www.mamicode.com/"d2811813649348ec9d68f27d398bfc3c" type="checkbox">
    <div class="v_text" style="text-align:left;">
      <img src=http://www.mamicode.com/"/FileFolder/SafeFileUpload/201611/20161129/51f334555cc641cbab20293571899d06.png" alt="图片1" width="75" height="95">
    </div>
  </li>
  <li style="width:80px;">
    <input class="v_list_chek" style="text-align:left;" value=http://www.mamicode.com/"d71840e233ab4281a12547a178145234" type="checkbox">
    <div class="v_text" style="text-align:left;">
      <img src=http://www.mamicode.com/"/FileFolder/SafeFileUpload/201611/20161129/2d0b580c313b45d58e57f50faccf989a.png" alt="图片1" width="75" height="95">
    </div>
  </li>
  <li style="width:80px;">
    <input class="v_list_chek" style="text-align:left;" value=http://www.mamicode.com/"37d43692c1e24814896c2dd740d40bff" type="checkbox">
    <div class="v_text" style="text-align:left;">
      <img src=http://www.mamicode.com/"/FileFolder/SafeFileUpload/201611/20161129/652b471ed37e4182ac2f7f13f47e6a8a.png" alt="图片1" width="75" height="95">
    </div>
  </li>
</ul>
 $("#btn_CheckManagerCompletionCreateAttachment_del").click(function () {
        var keys = "";
        $(".v_list_chek:checked").each(function () {
            keys += $(this).val().trim() + ",";
        });
        if (keys.length > 0) {
            //删除文件方法
            $.messager.confirm(删除提示, 确定删除该文件吗?, function (r) {
                if (r) {
                    data = { ID: keys };
                    Url = "FileUpload/DeleteFile";
                    data = JSON.stringify(data);
                    $.postServerJson(Url, data, function (res) {
                        if (res.Result) {
                            AttachmentDataGridLod();
                        }
                        else {
                            $.messager.alert(提示, 错误: + res.Msg, warning);
                        }
                    });
                }
            });

        }
        else {
            $.messager.alert("删除提示", "请选择数据后操作", "info");
            return false;
        }
    });

 

根据样式获取被选中的checkbox