JavaScript Tutorial/DOM Node/innerText
Assign value to the innerText node
<source lang="javascript">
Firefox does not support the innerText property. <html>
<head> <title>InnerText Example</title> <script type="text/javascript"> function useInnerText() { var oDiv = document.getElementById("div1"); oDiv.innerText = oDiv.innerText; } </script> </head> <body>
Hello world
<input type="button" value="Use InnerText" onclick="useInnerText()" /> </body>
</html></source>
Change the innerText
<source lang="javascript">
Firefox does not support the innerText property. <html>
<head> <title>InnerText Example</title> <script type="text/javascript"> function useInnerText() { var oDiv = document.getElementById("div1"); oDiv.innerText = "Hello world"; } </script> </head> <body>
This is my original text
<input type="button" value="Use InnerText" onclick="useInnerText()" /> </body>
</html></source>