What is onclick event in JavaScript?

JavascriptWeb DevelopmentFront End Technology

The onClick event is the most frequently used event type, which occurs when a user clicks the left button of the mouse.

Example

You can put your validation, warning etc., against this event type.

Live Demo

<html>
   <head>
      <script>
         <!--
            function sayHello() {
               alert("Hello World")
            }
         //-->
      </script>
   </head>
   <body>
      <p>Click the following button and see result</p>
      <form>
         <input type="button" onclick="sayHello()" value="Say Hello" />
      </form>
   </body>
</html>
raja
Published on 30-Jan-2018 14:55:39
Advertisements