How to include multiple js files using jQuery $.getScript() method?

To use multiple js files, use the same getScript(), which is used to add a single js file. We’re having result.js file with the following code snippet −

function CheckJS(){
   alert("This is JavaScript - File1");
}

We’re having result2.js file with the following code snippet −

function CheckJS(){
   alert("This is JavaScript – File2");
}

Example

Here's the code snippet to add multiple js files. Here, we will call the function in the above 2 js files −

   

      
       
      
   
   
   
   
      

Click on the button to load result.js file −

STAGE
Updated on: 2020-02-17T09:54:08+05:30

768 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements