JavaScript Sanitize Html
// Checks if the string has a <script> tag
Checker = new RegExp(`<[^>]*script`).test(`<script>`)
console.log(Checker)
Undefined
// Checks if the string has a <script> tag
Checker = new RegExp(`<[^>]*script`).test(`<script>`)
console.log(Checker)
/**
* @param {string} text
* @return {string}
*/
function sanitizeHTML(text) {
return $('<div>').text(text).html();
}
COPY