I'm trying to put some text which will confuse HTML parser inside the CDATA section for javascript to access. But seems it won't work in both firefox and Internet Explorer. In Firefix, it will treat it as comment, it's still possible to remove the <!-- and --> go get back the original content, in IE it's worse, CDATA seems be totally ignored. No way to get the content back.
<html>
<body>
<div id="test"><![CDATA[Testing Data here]]></div>
</body>
</html>
<script>
alert(document.getElementById("test").innerHTML );
alert(document.getElementById("test").firstChild.data);
</script>
Anybody has some idea to get back the CDATA in the HTML using javascript?
Thanks