Reputation: 11
I would like to remove an item from the checkbox list using its value
<input type="checkbox" name="chk" id="chk0" value ="Chicken">
$("#chk0:checkbox[value='Chicken']").parent().remove();
I am trying to remove the item but it is not working. I need some assistance.
Upvotes: 0
Views: 1293
Reputation: 2388
If "#chk0"
is your container. You will need to use
$("#chk0 :checkbox[value = 'Chicken']").parent().remove();
Note the space between the id and the :checkbox
Otherwise you will look for a checkbox with id ="chk0" instead of the checkbox inside of your container.
But if the #chk0
is the id for the input it will work fine..
Upvotes: 2