The above function will print current datetime in a popup. Let’s call this function on click events of various HTML controls. These HTML controls needs to put undertag of web page.
To call the function when a user submits a form, add the `onsubmit` attribute to the form and set its value to the function name. For example:
To call the function when a user clicks on a button, add the onclick attribute to the button and set its value to the function name. For example:
To call the function when a user clicks on a link with a p tag, you can use the same approach as for a hyperlink. For example: