Javascript examples for DOM:Element textContent
Set text content with element.textContent attribute
<html> <body> <h1> Travel Worthy </h1> <div id="message"> Welcome to our site!/* w w w . j ava2s . com*/ </div> <img src="http://www.java2s.com/style/download.png"> <script type="text/javascript"> var msg = 'this is a test!'; function updateMessage() { var el = document.getElementById('message'); el.textContent = msg; } updateMessage(); </script> </body> </html>