On Mon, Dec 14, 2009 at 11:08 PM, water [bro] mm <[email protected]> wrote:
>
> and if click remove, jquery just remove a link remove not tag <p>
> please help me.
>
That is because the "this" inside your click handler function refers
to the link (because the handler is onclick for the link) even though,
outside of that, it refers to "#droppable".
Try changing this:
removeLink.onclick = function()
{
$("#droppable").children('p').remove("#"+lid[0].id);
$(this).remove();
}
... to this:
removeLink.onclick = function()
{
$("#"+lid[0].id).remove();
}
If the IDs are unique this should work fine, as jQuery will find the P
directly instead of finding it through #droppable.