I apologize if this post has been made before but I wasn't able to find it.
Imagine we have
<button class="sample-class" role="button" tabindex="0" id="onEvent">play</button>
and then a Javascript to trigger it, like so
<script>
     $("#onEvent").click(function(){
       //do something
     })
<script>
Now if we have the same thing as such
<button class="sample-class" role="button" tabindex="0" onClick="foo()">play</button>
and we trigger it by
<script>
  function foo()
  {
     //Do something
  }
</script>
Could someone tell me the difference between using the two? In terms of which one gets called first, which is more efficient and if I use both, will they work?
Thanks!
 
     
     
    