|
-
Mar 28th, 2002, 11:21 AM
#1
Thread Starter
Fanatic Member
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.
-
Mar 28th, 2002, 01:23 PM
#2
Frenzied Member
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.
-
Mar 28th, 2002, 03:00 PM
#3
Thread Starter
Fanatic Member
Thats exactly what I wanted. 
Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|