Web text is not displaying properly with ampersand (&) character & amp;

时间:2016-04-15 11:08:52

标签: javascript html

I have a list of names in JavaScript, eg name = "John&martin" but in the display in my interface it looks like John&martin, with ampersand character printed as & not as &.

I worked with the UTF-8 or even with the ASCII code, but I find no result. How to print & character as & not as &?

1 个答案:

答案 0 :(得分:-1)

这是在没有更多上下文的情况下在黑暗中拍摄的,但您是否尝试过更改名称:

name = "John&martin"

为:

name = "John\&martin"