-
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.
-
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.
-
Thats exactly what I wanted. :)
Thanks for your help.