Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript htmlentities

function htmlEntities(str) {
    return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
}
Comment

javascript htmlentities

var sanitizeHTML = function (str) {
	var temp = document.createElement('div');
	temp.textContent = str;
	return temp.innerHTML;
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: jshint esversion 6 
Javascript :: create file if not exists nodejs 
Javascript :: two sum javascript 
Javascript :: react check if mounted 
Javascript :: js index sorted 
Javascript :: merge array within an array 
Javascript :: last element in array 
Javascript :: js capitalize 
Javascript :: javascript regex .test 
Javascript :: jquery remove option from select 
Javascript :: if back react 
Javascript :: tsconfig.json not generated 
Javascript :: us phone number regex 
Javascript :: read json file into object javascript 
Javascript :: javascript trigger change event 
Javascript :: javascript math.random 
Javascript :: nodejs fs delete non empty directory 
Javascript :: read file size javascript 
Javascript :: install swagger jsdoc 
Javascript :: btoa is not defined js 
Javascript :: how to use jquery timepicker 
Javascript :: reversed array loop 
Javascript :: how to install yup in react native 
Javascript :: firestore batch add array 
Javascript :: pi in js 
Javascript :: append meta tag to head javascript 
Javascript :: redirect react router 
Javascript :: javascript includes 
Javascript :: how to generate random id in javascript 
Javascript :: how to draw ellipse in javascript canvas 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =