Prototype Element.remove() not working in IE

Posted by Gonçalo Queirós on Stack Overflow See other posts from Stack Overflow or by Gonçalo Queirós
Published on 2010-05-18T20:11:29Z Indexed on 2010/05/19 10:20 UTC
Read the original article Hit count: 167

Filed under:
|
|
|

Hi there. I have a javascript function that gets a DIV by an ID and makes a clone. Then, removes the original DIV from DOM and inserts the cloned object..Everything works fine, except in IE, because the original DIV is never removed...

var loadingDiv = $(Sybil.conf.loadingDivId),
    loadingClone = loadingDiv.clone(true);

    console.log($$('.loadingImg'));
    loadingDiv.remove();
    //Insert the loading div on the page again
    elt.insert({after: loadingClone});
    [loadingClone].invoke(func);
    console.log($$('.loadingImg'));

The div also has a span inside with the class "loadingImg", so i just used the console.log to check how many elements there are. FF always prints [span.loadingImg] but IE prints [span.loadingImg,span.loadingImg] on the second console.log...
Any idea of what might be happening? Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about prototype