<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>
时间: 2024-10-19 18:33:25