Using addEventListener for Two Functions - Javascript DOM

Javascript examples for DOM:Event

Description

Using addEventListener for Two Functions

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <div id="myElement">
          Please click here./*from   w w  w .  ja  v a  2 s  .  c o  m*/
      </div> 
      <script>
            function func0() {
                console.log("Function0 is called");
            }
            function func1() {
                console.log("Function1 is called");
            }
            document.getElementById("myElement").addEventListener("click", func0, true);
            document.getElementById("myElement").addEventListener("click", func1, true);
        
      </script>  
   </body>
</html>

Related Tutorials