penguine Posted March 18, 2008 Share Posted March 18, 2008 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 More sharing options...
aspnetguy Posted March 18, 2008 Share Posted March 18, 2008 post the code for the whole page. There is a problem with your code if it is deleting other parents. Link to comment Share on other sites More sharing options...
jhecht Posted March 19, 2008 Share Posted March 19, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.