I work with Google maps. The coordinates of points on a map and description of these points lie in an XML document. Some of the descriptions have html tags. In the derivation of the page - they are displayed as . I understand that you need to replace < and > do it this function:
我使用谷歌地图。地图上点的坐标和这些点的描述位于XML文档中。一些描述有html标签。在页面的派生中 - 它们显示为。我知道你需要替换 <和> 执行此功能:
String.prototype.replaceAll = function(search, replace) {
return this.split(search).join(replace);
}
I use this:
我用这个:
var text = points_array[i]['text'];
text = text.replaceAll('<', "<");
var text2 = text.replaceAll('>', ">");
jQuery("#about").text(text2);
As a result, all the same effect it does not. What could be wrong?
结果,它没有相同的效果。可能有什么不对?
1 个解决方案
#1
1
you have to use jquery .html()
if you want the passed string to be treated as a HTML string otherwise it will always be interpreted as normal string of text
如果希望将传递的字符串视为HTML字符串,则必须使用jquery .html(),否则它将始终被解释为正常的文本字符串
#1
1
you have to use jquery .html()
if you want the passed string to be treated as a HTML string otherwise it will always be interpreted as normal string of text
如果希望将传递的字符串视为HTML字符串,则必须使用jquery .html(),否则它将始终被解释为正常的文本字符串