How to call multiple JavaScript functions in onclick event?


To call multiple JavaScript functions in on click event, use a semicolon as shown below −

onclick="Display1();Display2()"

Example

Live Demo

<html>
   <head>
      <script>
         function Display1() {
            document.write ("Hello there!");
         }
         function Display2() {
            document.write ("Hello World!");
         }
      </script>
   </head>
   <body>
      <p>Click the following button to call the function</p>
      <form>
         <input type = "button" onclick = "Display1(); Display2()" value = "Result">
      </form>
   </body>
</html>

Updated on: 12-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements