获取checked的值

 <div class="rule-multi-porp">
                        <span>
                            <%var itemList = PublicQuery.GetItemList();
                                foreach (var item in itemList)
                                {%>
                             <input id="cblGroupId_<%=item.ID %>" type="checkbox" name="cblGroupId$0" value="<%=item.ID %>" />
                            <label for="cblGroupId_<%=item.ID %>"><%=item.ItemName %></label>
                                <%}%>
                        </span>
                      </div>

Jquery:

   <script type="text/javascript">
                $("#biaoge").on('click', function () {
                    var a = $("input[name='cblGroupId$0']").prop({}).val();
                    var str = "";
                    $("input[name='cblGroupId$0']:checked").each(function(){
                        str += $(this).val() + ",";
                    })
                    console.log(str);
                });
            </script>

 

posted @ 2016-09-10 10:36  阿旭92312  阅读(1087)  评论(0编辑  收藏  举报