This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.



Smartphone icons created by Freepik - Flaticon

JS HTML Events

The onclick Events

Click "Try it" to execute the displayDate() function.

//onclick button with id="myBtn"
document.getElementById("myBtn").onclick = displayDate;

//onclick function
function displayDate() {
  document.getElementById("demo").innerHTML = Date();
}