“JQuery UNESCAPE HTML” Respostas de código

JQuery UNESCAPE HTML

<script>
var encodedStr = "This is fun &amp; stuff";
var decoded = $("<div/>").html(encodedStr).text();
console.log(decoded);
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div/>
Undefined

JQuery UNESCAPE HTML

function decodeEntities(encodedString) {
  var textArea = document.createElement('textarea');
  textArea.innerHTML = encodedString;
  return textArea.value;
}

console.log(decodeEntities('1 &amp; 2')); // '1 & 2'
Shadow

JQuery UNESCAPE HTML

var encodedStr = "This is fun &amp; stuff";
var decoded = $("<div/>").html(encodedStr).text();
console.log(decoded);


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div/>
Shadow

Respostas semelhantes a “JQuery UNESCAPE HTML”

Perguntas semelhantes a “JQuery UNESCAPE HTML”

Mais respostas relacionadas para “JQuery UNESCAPE HTML” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código