homepage Welcome to WebmasterWorld Guest from 54.234.128.25
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
can I delete the parent after the child.
tw56




msg:4393557
 7:40 pm on Dec 2, 2011 (gmt 0)

This deletes the child. "event.target.parentNode.removeChild(event.target);" . Event target is an image that is wrapped within a "p" element. Perhaps learn the parentNodes id before the delete?

 

Skier88




msg:4393587
 9:28 pm on Dec 2, 2011 (gmt 0)

If you're deleting the parent you don't have to delete the child first.

event.target.parentNode.parentNode.removeChild(event.target.paretNode);


You could also probably use "this" instead of "event.target".

this.parentNode.parentNode.removeChild(this.paretNode);

tw56




msg:4393804
 12:59 pm on Dec 3, 2011 (gmt 0)

Thanks. That worked.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved