开发者

innerHTML doesn't interpret HTML tags

I'm trying to replace the contents of a div with some piece of HTML. However the html is not interpreted. If error[0].childNodes[0].nodeValue contains blah <strong>foobar</strong> then I will see <strong> in the output. How can I fix this?

document.getElemen开发者_如何学PythontById("booking").innerHTML = "Server error: " + error[0].childNodes[0].nodeValue;


Is perhaps error[0].childNodes[0].nodeValue escaped? you could try:

document.getElementById("booking").innerHTML = "Server error: " + unescape(error[0].childNodes[0].nodeValue); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜