Answers for "javascript how to decode html"

0

Javascript convert html entity to string

const htmlEntities = {
    "&": "&",
    "<": "&lt;",
    ">": "&gt;",
    '"': "&quot;",
    "'": "&apos;"
  };
return str.replace(/([&<>\"'])/g, match => htmlEntities[match]);
}
Posted by: Guest on August-18-2020
0

unescape html js

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var Title = $('<textarea />').html("Chris' corner").text();
console.log(Title);
</script>
Posted by: Guest on August-31-2020

Code answers related to "javascript how to decode html"

Code answers related to "Javascript"

Browse Popular Code Answers by Language