As promessed..
the code
01 | <!DOCTYPE html> |
02 | <html> |
03 | <head> |
04 | <script type="text/javascript"> |
05 |
06 | function test() |
07 | { |
08 | //NodeList |
09 | var list = document.getElementsByTagName('p'); |
10 | var node = list.item(0); |
11 | node.parentNode.removeChild(node); |
12 | } |
13 |
14 | </script> |
15 |
16 | </head> |
17 | <body> |
18 | <p>Element 1</p> |
19 | <p>Element 2</p> |
20 | <p>Element 3</p> |
21 | <p>Element 4</p> |
22 | <p>Element 5</p> |
23 | <input type="button" onclick="test()" value="check me out"!/> |
24 |
25 | </body> |
26 | </html> |