Results 1 to 3 of 3

Thread: Delete And Tag/Element

  1. #1

    Thread Starter
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645

    Delete And Tag/Element

    Hi,

    This could be really simple but I'm not sure because I've never had to do it before.

    basically, if I use something like this...

    document.getElementByID('test').insertAdjacentHTML('afterEnd','<span id="banana">Testing</span>');

    How do I completely remove the <span> tag.

    I've tried using combinations of removeElement() and removeAttibute() but I cant figure it out.

    Thanks in advance.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    I haven't used this, but what about removeChild().

    I think it might work like this, but play with it and see.

    Code:
    document.getElementByID("parentID").removeChild(document.getElementByID("spanID"))
    There is also a removeNamedItem(). You can check that out.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3

    Thread Starter
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Thats exactly what I wanted.

    Thanks for your help.
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

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



Click Here to Expand Forum to Full Width