Horje
javascript covert html characters to text Code Example
js Convert the characters to the html
//To do this simply create a element in the DOM tree and 
//set the innerText of the element to your string. 
//Then retrieve the innerHTML of the element. 
//The browser will return an HTML encoded string.

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

console.log(HtmlEncode('&;\'><"'));

//expected output: &amp;;'&gt;&lt;"
javascript covert html characters to text
const decodeHTML = s => {
    var str, temp= document.createElement('p');
    temp.innerHTML= s;
    str= temp.textContent || temp.innerText;
    temp=null;
    return str;
}

console.log(decodeHTML('&lt;'));




Javascript

Related
Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSetti Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSetti
loop data from data base laravel to javascript Code Example loop data from data base laravel to javascript Code Example
mathjax arrow Code Example mathjax arrow Code Example
a complex label expression before a colon must be parenthesized Code Example a complex label expression before a colon must be parenthesized Code Example
babel-plugin-prismjs .babel.rc doesn't work Code Example babel-plugin-prismjs .babel.rc doesn't work Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8