开发者

javascript innerhtml issue

I'm trying to get the innerHTML value of a node. The value is 开发者_如何转开发D&O. When I try to get this value using innerHTML I'm getting D &amp[semicolon] O. Is there any option to get the exact value rather than encoded value using Javascript? Please help me.

Forum prevents me from entering semicolon after &amp


You can use

 return ("innerText" in node) ? node.innerText : node.textContent;

innerHTML will returns the equivalent HTML that would provide the text that you see.


element.firstChild.data;

Get the data in the text node contained in the element. If you want the text and not HTML that represents it, don't use innerHTML.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜