DOM innerHTML Duplicate Problem

Posted by Kubi on Stack Overflow See other posts from Stack Overflow or by Kubi
Published on 2010-04-12T10:06:47Z Indexed on 2010/04/12 10:53 UTC
Read the original article Hit count: 417

Filed under:
|
|
function SwapPlans(city, id) {
    var tp = GetTravelPlanById(id);
    var content = MakeHTMLAccordionMe(tp.items[0]);

    document.getElementById(city).innerHTML = " ";
    document.getElementById(city).innerHTML = content.innerHTML;
    document.getElementById(city).outerHTML = " ";
    document.getElementById(city).outerHTML = content.outerHTML;
}

Hi,

I have a problem with the snippet above. MakeAccordionME function returns the content that I want to change by document.getElementById(city) = value; but It doesn't remove the first content of the first div.

Is there any content.clear method in DOM javascript ?

thx

p.s. the div that returns from document.getElementById(city) is a jquery accordion div.

© Stack Overflow or respective owner

Related posts about dom

Related posts about jquery-accordion