Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    21
    Thanks
    6
    Thanked 0 Times in 0 Posts

    removing elements

    I put this at the end of my code thinking that after the div displays (id = 'link_container') I can eliminate (id = 'link_container') from memory when the script ends so there's a place for another div (id = 'link_container') when/if there's onkeyup event.

    Wouldn't this little script remove any element with an id = 'link_container' ?

    <script type="text/javascript">
    var deleteDiv = document.getElementById('link_container');
    document.body.removeChild(deleteDiv);
    </script>

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Code:
    deleteDiv.parentNode.removeChild( deleteDiv );

  • Users who have thanked Logic Ali for this post:

    niche (12-09-2011)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •