Example of changing the content of an element The current time is: Clicking on the button below modifies the date and time shown above (if JavaScript is enabled). Change content properties Code: function changeElement() { var elem = document.getElementById("dateTime"); var date = new Date(); elem.innerHTML = "The current time is: " + date.toTimeString(); } function init() { changeElement(); // sets time on initial page load document.getElementById("ChangeButton").onclick = changeElement; } window.onload = init;