Step 1 – Create blank html document and write basic html
In the above screenshot you will see I have created a basic html document with basic tags.
Now let’s add a button in our html code.
In the above screenshot you will see I have added onclick attribute with a value of myFunction().
In the above screenshot you will see I have created a function with the name “myFunction” and called an alert function inside it to show the message when we click on the button.
You may also like: