遍历已选中的checkbox

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhangmm122411/article/details/51490777

一、Handlebars模板代码:

<script id="myToSignTaskList_template" type="text/x-handlebars-template">
    {{#each this}}
        <li task_id="{{id}}">
            <div class="c_b">
                <div class="checkboxOne">
                        <input type="checkbox" value="{{bpmBizNum}}" id="checkboxInput_{{id}}" name="" />
                        <label for="checkboxInput_{{id}}"></label>
                </div>
            </div>
            <div class="tit">{{bpmBizTitle}}-{{bpmBizNum}}</div>
            <div class="row"><!-- 内容线 --><t:mutiLang langKey="common.business.line"/>: {{businessType_Value businessType}}<span class="pre50"></span></div>
            <div class="row"><!-- 时间 --><t:mutiLang langKey="common.time"/>{{dateFormat startTime}}</div>
            <div class="row"><!-- 提交人 --><t:mutiLang langKey="common.Submitter"/>:{{originator}}</div>
        </li>
    {{/each}}
</script>

二、JSP页面代码:

<!-- 底部签收 start -->
<div class="footer">
    <div class="f_fx">
        <div class="inner">
            <div id="div_sign_task" class="ft_cont">
                <em class="img icon-qs"></em>
                <span class="blue">签收</span>
            </div>
        </div>
    </div>
</div>
<!-- 底部签收 end -->

三、JavaScript代码:

$("#div_sign_task").click(function() { // 签收
    var ids = "";
    $("input:checkbox[id^='checkboxInput_']:checked").each(function(i) {
        //alert($(this).attr("checked"));
        if(i==0) {
            ids = $(this).val();
        } else {
            ids += (";" + $(this).val());
        }
    });
    //alert(ids);

    var locationUrl = ROOF.Utils.projectName()+"/task_to_sign_MobileController.do?my_to_sign_task_list_page&ids="+ids;
    window.location.href = locationUrl;
})

没有更多推荐了,返回首页