Link to home
Start Free TrialLog in
Avatar of madscientist
madscientist

asked on

removeChild() not working in IE

Hi, I have some elements which I have added using createElement() from a button event handler. I also have another button so that I can remove the elements which I have added, but although it worked in Firefox and Opera, both IE 6 and 7 won't do it.

HTML:
<div id="container">
<table id="table">
  <tr id="tr1">
    [......]
  </tr>
  <tr id="tr2"><!--This and its children created using createElement()...-->
    [......]
  </tr>
<table>
</div>

JS:
function remove_elem() {
  var elemid = document.getElementById('tr2');
  elemid.parentNode.removeChild(elemid);
}

Many Thanks, Adam.
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial