1

I have two event handler method attached on same element. As you can see, one is from the top of the html and other one is from end of the html. What is the order of executing the hadler method. Is there any chance that the order of execution is random ? Or first one is always invoked before last one?

<html>
<head>
    <script>
        $(function(){
             $('body').on('click', '#link', function (e) {
                 alert("should it call first always?");
             });
        });
    </script>
</head>

<body>
    <a id= "link" href="google.com"></a>
</body>

    <script>
        $(function() {
             $('body').on('click', '#link', function (e) {
                 alert("is there any chance that it will be called first?");
             });
        });
    </script>
</html>
Subrata nath
  • 172
  • 10

0 Answers0