Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js encode to &

function encodeToAmp(text) {
  var el = document.createElement("div");
  
  el.textContent = text;
  el.innerText = text;
  return el.innerHTML;
}

encodeToAmp('&;'><"')  //  =>  &amp;;'&gt;&lt;"
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery on load 
Javascript :: firebase react router page not found on page refresh 
Javascript :: discount calculator javascript 
Javascript :: javascript get date name 
Javascript :: form.select react bootstrap 
Javascript :: sleep function js 
Javascript :: changing the active class on press 
Javascript :: js history back 
Javascript :: javascript add button to div 
Javascript :: auto increment schema mongoose id 
Javascript :: react native navigation.navigate with params 
Javascript :: javascript padend 
Javascript :: javascript switch statement multiple cases 
Javascript :: what can i delete from create-react-app 
Javascript :: jest console.log 
Javascript :: toggle bollean value in js 
Javascript :: JavaScript - The first word of a string 
Javascript :: Error serializing `.list Data` returned from `getStaticProps` 
Javascript :: get all local storage 
Javascript :: cookie js 
Javascript :: install gulp ubuntu 20.04 
Javascript :: regex on input 
Javascript :: js code to take value from form and store it in a variable 
Javascript :: jquery click hold down 
Javascript :: momeny day in range 
Javascript :: integers to space separated string in javascript 
Javascript :: nodejs on exit event 
Javascript :: js code stars 
Javascript :: express get client ip 
Javascript :: jest testmatch specific folder 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =