replaceWith, keeps reference of replaced object?
Hi,
I replace an element with another element:
- $("iframe").each(function(){
- var frame=$(this);
- $(this).contents().find("div").each(function(){
- var ID=$(this).attr('pid');
- var span=document.createElement("span");
- span.innerHTML=$(this).html();
- span.setAttribute('pid',ID);
- $(this).replaceWith( $(span) );
- });
- });
The div disappears. However, if after this I make a find in frame contents, with a scrollTo to each find it moves to the disappeared div, despite not being there. Does the frame keeps the reference of the replaced object? How to get rid of it?