How can i decode html entities with jquery like with php function htmlspecialchars_decode? I have this code:
if (jQuery.trim(jQuery("#push_alert").val()) != "") {
alert = jQuery("#push_alert").val();
}
And whenever the text has &
in it, it outputs %amp;
Is there a simple way to do it?
As far i know jQuery itself will give you whatever you entered as a string.
<textarea id="mytextarea"> a & b</textarea>
$('#mytextarea').keyup(function() {
alert($(this).val())
});
You can provide exact html and jQuery code to investigate further. Here is jsfiddle : https://jsfiddle.net/0ynm4zf1/
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.