javascript - Convert special chars to HTML -


$scope.html = '<script>'; 

i know php has ability convert &lt;script&gt; <script> can javascript same?

using works

function escapespecialchars(text) {     return text         .replace(/&amp;/g, "&")         .replace(/&lt;/g, "<")         .replace(/&gt;/g, ">")         .replace(/&quot;/g, "\"")         .replace(/&#039;/g, "'"); } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -