Jump to content

how delete a parent id without affecting other parents?


penguine

Recommended Posts

Hi I like to know how to delete a parent Id without deleting other parents?.i used prototype frame work to find ids.let child be an element id.i like to delete child and its parent.Theparent is a div.

parent=$(child ).ancestors();		 parentId=parent[0].id;				$(parentId).remove();

This code deleting the parent and child.But the problem is some times other elements at the level of parent also deleted from the page(when refreshing that elements redisplays).any idea?

Link to comment
Share on other sites

I know that MooTools took a bit of functionality from Prototype, so if it's anything alike, then something like this would work(or should, theoretically)

var child = $('childId');var parent = child.getParent();child.remove();parent.remove();

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...