Javascript examples for DOM:Element innerText
Replace the text of span element with HTML entity
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//w w w .j a v a2s .co m var foo = document.getElementById('foo'), bar = document.getElementById('bar'); foo.onclick = function (e) { foo.innerHTML = '€!'; bar.innerText = '€!' }; } </script> </head> <body> <div id="foo"> Foo </div> <div id="bar"> Bar </div> </body> </html>