Possible Duplicate:
Selecting HTML Comments with jQuery
Ajax functions like .load() strip out comments from the HTML. How can I keep the comments?
我们正在进行 AJAX 调用,结果通过
$('#page_section').html(result);
问题是结果被从我们在那里的所有 HTML 注释中删除。
我们需要将 HTML 注释保留在那里,因为它们包含稍后我们的 CMS 需要的 JSON 对象。
任何阻止 HTML 注释被使用 .html()
删除的想法方法.
谢谢!
最佳答案
html()
方法不会删除注释:http://jsfiddle.net/WEQW9/
这是ajax方法,查看 Ajax functions like .load() strip out comments from the HTML. How can I keep the comments?
关于jquery - 使用 jquery .html() 时防止 HTML 注释被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13709255/