jeudi 26 mars 2015

Why unescaped innerHTML not worked? [duplicate]


This question already has an answer here:




Here my html:



<!DOCTYPE html>
<html>
<head></head>
<body>
<div id="pnl">
<div>
#if {{item.user.age}} > 25 # {{item.user.age}} #end
</div>
</div>
<textarea id="txt" style="width: 500px; height: 500px;"></textarea>

<script>
var div = document.querySelector("#pnl");

//var text = unescape(div.innerHTML);
//var text = decodeURI(div.innerHTML);
var text = decodeURIComponent(div.innerHTML);

document.querySelector("#txt").value = text;

</script>
</body>
</html>


And I always getting '&gt_;' instead of '>'. unescape or decodeURIComponent don't help me :(. Also screenshot http://ift.tt/1BtgXmH





Aucun commentaire:

Enregistrer un commentaire