简体   繁体   English

是否有像.html这样的函数可以保留unicode?

[英]Is there a function like .html that preserves unicodes?

For an object in Javascript, I need its XML structure, including all unicodes. 对于Javascript中的对象,我需要它的XML结构,包括所有unicode。 The method .html() basically fulfills this purpose, but converts the unicodes to html characters. 方法.html()基本上实现了此目的,但是将unicodes转换为html字符。 Is there a similar method that does not do this? 有没有类似的方法不能做到这一点? And if not, is there a list of entities that are converted by .html() which one could use to convert them back? 如果没有,是否存在一列由.html()转换的实体,可以用来将它们转换回去?

您可以尝试javascript outerHTML属性:

document.getElementById('sampleId').outerHTML

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM