I have an ASP.NET CheckBoxList:
<asp:CheckBoxList ID="CheckBoxList1" runat="server" Width="10%">
<asp:ListItem Selected="True" Value="1">White</asp:ListItem>
<asp:ListItem Selected="False" Value="2">Black</asp:ListItem>
<asp:ListItem Value="3">Red</asp:ListItem>
<asp:ListItem Value="4">Green</asp:ListItem>
<asp:ListItem Value="5">Blue</asp:ListItem>
</asp:CheckBoxList>
I need to modify/delete a particular label of a particular CheckBox in a CheckBoxList:
The following code is working fine for the CheckBox value, however it is not working for the CheckBox label.
var CheckBoxListInputValue = 3; //value may be dynamic
var CheckBoxListInputInnerHTML = "Red"; //value may be dynamic
$("#CheckBoxList1 label[innerHTML =" + CheckBoxListInputInnerHTML + "]").remove(); //Not working
$("#CheckBoxList1 :input[value = " + CheckBoxListInputValue + "]").remove(); //Working
BTW, I don't want to use any for loop.