Forum Documentation

Javascript problem: nodeValue property not working

Here is an example:



<script type="text/javascript">
        var p = document.getElementsByTagName("p")[0];
        p.replaceChild(document.createTextNode("haha"), p.firstChild);
        //p.firstChild.nodeValue = "haha"; // not working


What I want to do is to replace the text in the first paragraph (which is "1") with a string "haha". I tried to use nodeValue to set the text but failed, instead I have to use replaceChild to achieve this. Is it a bug?
Yes, this should be fixed in Prince 8.1, along with support for the textContent property.