Possible Duplicate:
HTML Entity Decode
I want to convert this string
<p>update this post</p>
to
<p>update this post</p>
in Javascript.
Do you have any idea? Thanks in advance.
Possible Duplicate:
HTML Entity Decode
I want to convert this string
<p>update this post</p>
to
<p>update this post</p>
in Javascript.
Do you have any idea? Thanks in advance.
I'd create an element, set its innerHTML and get its innerText:
var element = document.createElement('div');
element.innerHTML = '<p>update this post</p> ';
console.log(element.innerText);
The result is:
"<p>update this post</p> "
$('<div />').html('<p>update this post</p> ').text();You can use this method:
var param = '<p>update this post</p>';
unescape(param);
unescapefunction (which is deprecated because it can't handle Unicode properly) doesn't work on that form of escaping.