Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

what does sanitize do javascript

// our input string to clean
const stringToClean = 'Some text <b><i>with</i></b> <blink>tags</blink>, including a rogue script <script>alert(1)</script> def.';

const result = new Sanitizer().sanitize(stringToClean);
// Result: A DocumentFragment containing text nodes and a <b> element, with a <i> child element
Comment

sanitize html in JavaScript

/**
 * @param {string} text
 * @return {string}
 */
function sanitizeHTML(text) {
  return $('<div>').text(text).html();
}
COPY
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongoose create 
Javascript :: numero random en js 
Javascript :: Using axios send a GET request to the address: 
Javascript :: js string to blob 
Javascript :: how to print in java script 
Javascript :: range command in JS 
Javascript :: javascript search after user stops typing 
Javascript :: jquery get value of td by class 
Javascript :: compare strings js 
Javascript :: function prototype in javascript 
Javascript :: JavaScript String endsWith() examples 
Javascript :: How to add a class to html element js 
Javascript :: adding logo to vscode extension development 
Javascript :: react router go back 
Javascript :: remove index from array javascript 
Javascript :: sort() object values javascript 
Javascript :: nodejs: basic: send html page to Browser 
Javascript :: overflowy 
Javascript :: run javascript in iframe 
Javascript :: console.log() Print Values Stored in Variables 
Javascript :: stack example in javascript 
Javascript :: Put Variable Inside JavaScript String 
Javascript :: js array remove undefined values 
Javascript :: reset value object js 
Javascript :: javascript single thread 
Javascript :: google autocomplete not returning lat long 
Javascript :: check if form bootstrap is valid js 
Javascript :: console.log() Print a Sentence 
Javascript :: how to give icon in input type file react 
Javascript :: js number to str 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =