首页 > 代码库 > 获取checked的值

获取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=http://www.mamicode.com/"<%=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>

 

获取checked的值