screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head></head> <body> <h2>Javascript dynamically add text to div | innerHTML</h2> <div id="myDiv"></div> <button id="addTextButton">Add Text</button> <script> window.onload = function () { var div = document.getElementById("myDiv"); var addButton = document.getElementById("addTextButton"); addButton.onclick = function () { div.innerHTML = "This is the dynamically added text."; }; }; </script> </body> </html>