Skip to content Skip to sidebar Skip to footer

Internet Explorer And Removechild()

I have been using elem.removeChild() to remove elements from my document, but saving a JavaScript reference to that element, so that I can add them back when appropriate. Works ju

Solution 1:

The spec for removeChild doesn't explicitly say that the children of the node being removed should be kept along with that node, although to me it seems logical that they should and obviously that is what the FF and Chrome developers decided too. I don't know what the spec says to do if the parent's innerHTML is set to an empty string, but in my opinion that way is a bit like saying "wipe over whatever was there" so in that case I think it is reasonable for the browser to throw away everything that was in that innerHTML even if there were references in code to some of the removed elements.

Solution 2:

Without seeing more of your implementation, I'm not sure you'll get more than blind answers; here's one:

Do you happen to be working with table rows? Check out this answer . Apparently <tr> has to attach to <tbody> in IE, rather than directly to a <table>.

Post a Comment for "Internet Explorer And Removechild()"