Hi,
I'm trying to remove an html element in the example below. I don't see
the "bye" message at the end and there are no errors reported in
Firefox or exceptions caught if I wrap the remove child line in a
try-catch. Any ideas what is wrong?
Thanks,
Peter
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>garbage</title>
</head>
<body>
<div id="my_div">hi<div>
<script type='text/javascript'>
var my_div = document.getElementById("my_div");
my_div.parentNode.removeChild(my_div);
document.write("bye");
</script>
</body>
</html>
Csaba Gabor - 30 May 2006 22:43 GMT
> I'm trying to remove an html element in the example below. I don't see
> the "bye" message at the end and there are no errors reported in
[quoted text clipped - 3 lines]
> Thanks,
> Peter
...
> <div id="my_div">hi<div>
It works better for me if I close the element thusly:
<div id="my_div">hi</div>
Csaba
petermichaux@gmail.com - 31 May 2006 00:20 GMT
> ...
> > <div id="my_div">hi<div>
[quoted text clipped - 3 lines]
>
> Csaba
doh! Thanks. I just couldn't see it this time. Next time I'll validate
first.
Peter