javascript - Convert special chars to HTML -
$scope.html = '<script>';
i know php has ability convert <script>
<script>
can javascript same?
using works
function escapespecialchars(text) { return text .replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, "\"") .replace(/'/g, "'"); }
Comments
Post a Comment