Jump to content
penguine

how delete a parent id without affecting other parents?

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?

Share this post


Link to post
Share on other sites

post the code for the whole page. There is a problem with your code if it is deleting other parents.

Share this post


Link to post
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();

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...