Using jquery, C # to get the CheckBoxList selection, the following is achieved, interested friends can refer to the following
The PHP code is as follows:
. CheckBoxList label {margin-right:20px;}
The PHP code is as follows:
var label; $ ("#ddlplatform input:checkbox:checked"). each (function () {label + = $ (this). Next (). html ();});
The PHP code is as follows:
<asp:checkboxlist id= "Ddlplatform" runat= "server" repeatdirection= "horizontal" repeatlayout= "Flow" CssClass= " CheckBoxList "> <asp:listitem value=" APP ">APP</asp:ListItem> <asp:listitem value=" mobile touchscreen "> Mobile touch screen </asp:ListItem> <asp:listitem value= "PC" >PC</asp:ListItem> <asp:listitem value= "" ></asp :listitem> <asp:listitem value= "Weibo" > Weibo </asp:ListItem> </asp:CheckBoxList>
The PHP code is as follows:
Use platform string platfrom = String. Empty; foreach (ListItem li in This.ddlplatform.Items) {if (li. Selected) {platfrom + = li. Text + ","; }} platfrom = Platfrom.trimend (', ');