unescape data with jquery
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)
精彩评论