L
louvinon
Hi,
I use the function outerHTML in order to get the html of a div.
But specials caracteres are decoded.
For example :
when I click on the button "Show" , I obtain :
<DIV id=example val='test with & $B!l(B < " > '>test with & < "
></DIV>
If you compare the html code (see below) with the value of the
attribute 'val', you can see it's different. < becomes <, >
becomes > ...
How can I do to get exactly the same code ?
Thanks.
I use the function outerHTML in order to get the html of a div.
But specials caracteres are decoded.
For example :
when I click on the button "Show" , I obtain :
<DIV id=example val='test with & $B!l(B < " > '>test with & < "
></DIV>
If you compare the html code (see below) with the value of the
attribute 'val', you can see it's different. < becomes <, >
becomes > ...
How can I do to get exactly the same code ?
Thanks.
Code:
<html><head>
<title>SOS</title>
<script>
function show() {
alert(document.getElementById("example").outerHTML);
}
</script>
</head><body>
<div id="example" val="test with & ′ < " >
">test with & < " ></div>
<button onclick="show()">SHOW</button>
</body>
</html>