This is a piece of code which is normally used by the majority of programmers:
<input type="text" id="myID" onchange="myFunction()" />
<script>
     function myFunction (){
          //DO THIS
     }
</script>
But in my case I prefer to create a file with .js extension that contains only Javascript and .html that contains only HTML. So in my index.html I have this line:
<input type="text" id="myID"/>
And in main.js I have this line:
function myFunction (id){
      $(id).change({
           //DO THIS
      });
 }
 myFunction("#myID");
The two methods are the same and do the same thing, but what is the best? What is the best performance between inline Javascript code and pure Javascript code?
 
     
     
     
     
    