Inner HTML
Inner HTML
InnerHTML
InnerHTML
The innerHTML property can be used to modify your
document's HTML on the fly.
When you use innerHTML, you can change the page's content without refreshing the page. This can make your website feel quicker and more responsive to user input.
The
InnerHTML Example
<script type="text/javascript"> function Msg1(){ document.getElementById('myText').innerHTML = 'Thanks!'; } function Msg2(){ document.getElementById('myText').innerHTML = 'Try message 1 again...'; } </script> <input type="button" onclick="Msg1()" value="Show Message 1" /> <input type="button" onclick="Msg2()" value="Show Message 2" /> <p id="myText"></p>