开发者

unescape data with jquery

开发者 https://www.devze.com 2023-02-10 06:20 出处:网络
So, I have data like: \"recipient\'s name\" That 开发者_Go百科was encoded on the server as: recipient's name

So, I have data like:

"recipient's name"

That 开发者_Go百科was encoded on the server as:

recipient's name

Then, I try to dynamically update a div with this text.

$(this).html("recipient's")

But I get recipient's name as content of the div. I would have thought that text() would have outputted the text literally, whereas html() would have converted special characters.

How can I actually get the text "recipient's name" in there? (I cannot decode the string server-side because of XSS injection)


There must be something else going on, I tried this on jsfiddle.net and it worked fine under Firefox 3.6.x and Chrome 9.0.

(click on the link above and press 'run' to see it in action)

0

精彩评论

暂无评论...
验证码 换一张
取 消