Kubi
Kubi

Reputation: 2169

Javascript DOM encoded html code problem

    var accordion = document.createTextNode(tp.getAccordionContent());
    var el = document.createElement("div");
    el.appendChild(accordion);
    document.getElementById("gp").appendChild(el);

tp.getAccordion() function returns me a string like < div .... and it is being decoded. All I want is to get it encoded and implement the div which has an id = gp with that data.

any help and advises would be greatly appreciated.

Upvotes: 1

Views: 80

Answers (2)

remi
remi

Reputation: 1303

document.getElementById("gp").innerHTML = tp.getAccordionContent();

Upvotes: 2

Johan Dahlin
Johan Dahlin

Reputation: 26496

document.getElementById("gp").innerHTML += "..."; might be what you want

Upvotes: 1

Related Questions