In browser, it's showing something like below:
when I inspect it in developer console, it is showing normal:
so, it looks like the colon is a not being improperly encoded.
The problem is that I don't have control of the content, the information is retrieved from somewhere else using ajax call and I use jQuery to retrieve city information.
var toCity = $(infoOutHtml).find('#HeaderDes').text();
when I console.log(toCity)
it shows normal in console: 目 的 地:中国
but when I render it to html, it become weird:
var Information = "<div id=\"trackingNum\" class=\"spacer-banner blueFontWhiteBg\">"+
"<span id=\"transit-id\">"+toCity +"</span>"+
"</div>"
$($info).html(information);
I am just wondering what's the problem here? how to ignore the colon before render it to html?
I tried this, but doesn't work at all:
function somefunction(string){
return string.replace(/:/,'\\\\:');
}
toCity = somefunction(toCity);
@krtek是正确的,我使用了没有“:”的字体系列。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.