$(".remove, #ccusers").bind("click", function () {
$(this).parent().remove();
});
To make shure you are removing the right parent element up in the tree and its children you can try this:
$(this).parents('theParentYouWantToRemove').remove();
You may find this useful: What is the difference between the bind and live methods in jQuery?
P.S. I suggest you to use only $('.remove')
, as I don't see any reason why you are doing $('.remove, #ccusers')
, as it will actually mean:
elements.remove
OR element #ccusers
,
And by doing: $('.element' , '#element')
(look at the quotes!) your 'second' element will do absolutely NOTHING ! (like many here suggested).
So my only valid suggestion would be:
$(".remove").bind("click", function () {
$(this).parents('#ccusers').remove(); // or .parent() as I explained above
});
(download and try in IE)