onEvent = "code to handle the event"
Now click on the Date button to change the output as shown in the following figure:
Here is the live demo output produced by the above event handling example program.
Click on the Date button to replace me with today's date and time.
Now here is another example which will change the content of it's own element:
This is the output produced after clicking on the Date button.